@@ -15,32 +15,47 @@ def check_format(_string):
15
15
return "NUMBER"
16
16
if re .match (r"[a-z0-9-_]+\.ton" , _string .strip ()):
17
17
return "DOMAIN"
18
- if re .match (r"@[a-z0-9 ]" , _string .strip ()):
18
+ if re .match (r"@[a-z0-9_ ]" , _string .strip ()):
19
19
return "NICKNAME"
20
20
return "NONE"
21
21
22
22
23
23
def scan_ton ():
24
-
25
24
search_maltego = asset_maltego .lower ()
26
25
if check_format (search_maltego ) == "NONE" :
27
26
search_maltego = "@" + search_maltego
28
27
29
28
try :
30
29
telegram_pivot = True
31
30
32
- if len (config )== 0 or ( not config ["API_ID" ] or not config ["API_HASH" ] or not config ["SESSION_STRING" ] ):
31
+ if len (config ) == 0 or (
32
+ not config ["API_ID" ]
33
+ or not config ["API_HASH" ]
34
+ or not config ["SESSION_STRING" ]
35
+ ):
33
36
telegram_pivot = False
34
37
35
- #print("telegram input --> " + search_maltego, str(True), str(False), str(True), "pivot: "+str(telegram_pivot), "---", config["API_ID"],
38
+ # print("telegram input --> " + search_maltego, str(True), str(False), str(True), "pivot: "+str(telegram_pivot), "---", config["API_ID"],
36
39
# config["API_HASH"],"---", config["SESSION_STRING"])
37
- #print("telegram pivot: " + str(telegram_pivot))
40
+ # print("telegram pivot: " + str(telegram_pivot))
38
41
39
42
if telegram_pivot :
40
- current_parser = Ton_retriever (search_maltego , True , False , True , telegram_pivot ,None , config ["API_HASH" ], config ["API_ID" ]
41
- ,None , config ["SESSION_STRING" ])
43
+ current_parser = Ton_retriever (
44
+ search_maltego ,
45
+ True ,
46
+ False ,
47
+ True ,
48
+ telegram_pivot ,
49
+ None ,
50
+ config ["API_HASH" ],
51
+ config ["API_ID" ],
52
+ None ,
53
+ config ["SESSION_STRING" ],
54
+ )
42
55
else :
43
- current_parser = Ton_retriever (search_maltego , True , False , True , telegram_pivot )
56
+ current_parser = Ton_retriever (
57
+ search_maltego , True , False , True , telegram_pivot
58
+ )
44
59
current_parser .start_searching ()
45
60
except Exception as exx :
46
61
print (f"we got some problem, { exx } " )
@@ -112,47 +127,58 @@ def scan_ton():
112
127
description = ""
113
128
partecipants = ""
114
129
115
- if "tg-data" in item .keys ():
130
+ if "tg-data" in item .keys ():
116
131
if "apidetail" in item ["tg-data" ][2 ].keys ():
117
132
id = str (item ["tg-data" ][2 ]["apidetail" ].id )
118
133
if item ["tg-data" ][2 ]["apidetail" ].first_name :
119
- name = name + item ["tg-data" ][2 ]["apidetail" ].first_name
134
+ name = name + item ["tg-data" ][2 ]["apidetail" ].first_name
120
135
if item ["tg-data" ][2 ]["apidetail" ].last_name :
121
- name = name + item ["tg-data" ][2 ]["apidetail" ].last_name
136
+ name = name + item ["tg-data" ][2 ]["apidetail" ].last_name
122
137
123
138
if "webdetail" in item ["tg-data" ][2 ].keys ():
124
- if item ["tg-data" ][2 ]["webdetail" ]["nickname" ] and item ["tg-data" ][2 ]["webdetail" ]["nickname" ] != "N/A" :
139
+ if (
140
+ item ["tg-data" ][2 ]["webdetail" ]["nickname" ]
141
+ and item ["tg-data" ][2 ]["webdetail" ]["nickname" ] != "N/A"
142
+ ):
125
143
nickname = item ["tg-data" ][2 ]["webdetail" ]["nickname" ]
126
144
127
- if item ["tg-data" ][2 ]["webdetail" ]["kind" ] and item ["tg-data" ][2 ]["webdetail" ][
128
- "kind" ] != "N/A" :
145
+ if (
146
+ item ["tg-data" ][2 ]["webdetail" ]["kind" ]
147
+ and item ["tg-data" ][2 ]["webdetail" ]["kind" ] != "N/A"
148
+ ):
129
149
kind = item ["tg-data" ][2 ]["webdetail" ]["kind" ]
130
150
131
- if item ["tg-data" ][2 ]["webdetail" ]["participants" ] and item ["tg-data" ][2 ]["webdetail" ][
132
- "participants" ] != "N/A" :
133
- partecipants = item ["tg-data" ][2 ]["webdetail" ]["participants" ]
134
-
135
- if item ["tg-data" ][2 ]["webdetail" ]["image" ] and item ["tg-data" ][2 ]["webdetail" ][
136
- "image" ] != "N/A" :
151
+ if (
152
+ item ["tg-data" ][2 ]["webdetail" ]["participants" ]
153
+ and item ["tg-data" ][2 ]["webdetail" ]["participants" ]
154
+ != "N/A"
155
+ ):
156
+ partecipants = item ["tg-data" ][2 ]["webdetail" ][
157
+ "participants"
158
+ ]
159
+
160
+ if (
161
+ item ["tg-data" ][2 ]["webdetail" ]["image" ]
162
+ and item ["tg-data" ][2 ]["webdetail" ]["image" ] != "N/A"
163
+ ):
137
164
photo = item ["tg-data" ][2 ]["webdetail" ]["image" ]
138
165
139
- if item ["tg-data" ][2 ]["webdetail" ]["description" ] and item ["tg-data" ][2 ]["webdetail" ][
140
- "description" ] != "N/A" :
141
- description = item ["tg-data" ][2 ]["webdetail" ]["description" ]
166
+ if (
167
+ item ["tg-data" ][2 ]["webdetail" ]["description" ]
168
+ and item ["tg-data" ][2 ]["webdetail" ]["description" ]
169
+ != "N/A"
170
+ ):
171
+ description = item ["tg-data" ][2 ]["webdetail" ][
172
+ "description"
173
+ ]
142
174
143
175
extra_attributes = []
144
- extra_attributes .append (
145
- ["id" , "Id" , "id" , id ]
146
- )
147
- extra_attributes .append (
148
- ["name" , "Name" , "name" , name ]
149
- )
176
+ extra_attributes .append (["id" , "Id" , "id" , id ])
177
+ extra_attributes .append (["name" , "Name" , "name" , name ])
150
178
extra_attributes .append (
151
179
["nickname" , "Nickname" , "nickname" , nickname ]
152
180
)
153
- extra_attributes .append (
154
- ["kind" , "Kind" , "kind" , kind ]
155
- )
181
+ extra_attributes .append (["kind" , "Kind" , "kind" , kind ])
156
182
extra_attributes .append (
157
183
["description" , "Description" , "description" , description ]
158
184
)
@@ -167,11 +193,9 @@ def scan_ton():
167
193
168
194
if photo != "" and photo != "N/A" :
169
195
extra_attributes = []
170
- extra_attributes .append (
171
- ["url" , "Url" , "url" , photo ]
172
- )
196
+ extra_attributes .append (["url" , "Url" , "url" , photo ])
173
197
tgPhoto = MaltegoEntity (
174
- "maltego.Image" ,photo , extra_attributes
198
+ "maltego.Image" , photo , extra_attributes
175
199
)
176
200
trx .entities .append (tgPhoto )
177
201
0 commit comments