Skip to content

Commit 3806c61

Browse files
committed
Added login module + saving access file in a specific path.
1 parent 1804f54 commit 3806c61

File tree

1 file changed

+60
-36
lines changed

1 file changed

+60
-36
lines changed

atop-maltego.py

+60-36
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,47 @@ def check_format(_string):
1515
return "NUMBER"
1616
if re.match(r"[a-z0-9-_]+\.ton", _string.strip()):
1717
return "DOMAIN"
18-
if re.match(r"@[a-z0-9]", _string.strip()):
18+
if re.match(r"@[a-z0-9_]", _string.strip()):
1919
return "NICKNAME"
2020
return "NONE"
2121

2222

2323
def scan_ton():
24-
2524
search_maltego = asset_maltego.lower()
2625
if check_format(search_maltego) == "NONE":
2726
search_maltego = "@" + search_maltego
2827

2928
try:
3029
telegram_pivot = True
3130

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+
):
3336
telegram_pivot = False
3437

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"],
3639
# config["API_HASH"],"---", config["SESSION_STRING"])
37-
#print("telegram pivot: " + str(telegram_pivot))
40+
# print("telegram pivot: " + str(telegram_pivot))
3841

3942
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+
)
4255
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+
)
4459
current_parser.start_searching()
4560
except Exception as exx:
4661
print(f"we got some problem, {exx}")
@@ -112,47 +127,58 @@ def scan_ton():
112127
description = ""
113128
partecipants = ""
114129

115-
if "tg-data" in item.keys():
130+
if "tg-data" in item.keys():
116131
if "apidetail" in item["tg-data"][2].keys():
117132
id = str(item["tg-data"][2]["apidetail"].id)
118133
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
120135
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
122137

123138
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+
):
125143
nickname = item["tg-data"][2]["webdetail"]["nickname"]
126144

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+
):
129149
kind = item["tg-data"][2]["webdetail"]["kind"]
130150

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+
):
137164
photo = item["tg-data"][2]["webdetail"]["image"]
138165

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+
]
142174

143175
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])
150178
extra_attributes.append(
151179
["nickname", "Nickname", "nickname", nickname]
152180
)
153-
extra_attributes.append(
154-
["kind", "Kind", "kind", kind]
155-
)
181+
extra_attributes.append(["kind", "Kind", "kind", kind])
156182
extra_attributes.append(
157183
["description", "Description", "description", description]
158184
)
@@ -167,11 +193,9 @@ def scan_ton():
167193

168194
if photo != "" and photo != "N/A":
169195
extra_attributes = []
170-
extra_attributes.append(
171-
["url", "Url", "url", photo]
172-
)
196+
extra_attributes.append(["url", "Url", "url", photo])
173197
tgPhoto = MaltegoEntity(
174-
"maltego.Image",photo , extra_attributes
198+
"maltego.Image", photo, extra_attributes
175199
)
176200
trx.entities.append(tgPhoto)
177201

0 commit comments

Comments
 (0)