Skip to content

Commit afce866

Browse files
authored
Merge pull request #23 from intelowlproject/develop
For release 1.3.2
2 parents 7faf1e0 + 5c6a41f commit afce866

File tree

4 files changed

+96
-74
lines changed

4 files changed

+96
-74
lines changed

domain_checkers.py

Lines changed: 87 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ def check_url(self):
4949
urls.vturl_check()
5050
elif "VirusTotal_v3" in result["name"]:
5151
print("-" * 120)
52-
print("[*] Try using VirusTotal_v2 for URLs"
53-
"instead of VirusTotal_v3!")
54-
elif "HybridAnalysis" in result['name']:
52+
print(
53+
"[*] Try using VirusTotal_v2 for URLs"
54+
"instead of VirusTotal_v3!"
55+
)
56+
elif "HybridAnalysis" in result["name"]:
5557
urls = Hybrid(result["report"], self.value)
5658
urls.ha_check()
5759
elif "OTXQuery" in result["name"]:
@@ -69,9 +71,11 @@ def check_domain(self):
6971
domains.vt_check()
7072
elif "VirusTotal_v3" in result["name"]:
7173
print("-" * 120)
72-
print("[*] Try using VirusTotal_v2 for domains"
73-
"instead of VirusTotal_v3!")
74-
elif "HybridAnalysis" in result['name']:
74+
print(
75+
"[*] Try using VirusTotal_v2 for domains"
76+
"instead of VirusTotal_v3!"
77+
)
78+
elif "HybridAnalysis" in result["name"]:
7579
domains = Hybrid(result["report"], self.value)
7680
domains.ha_check()
7781
elif "OTXQuery" in result["name"]:
@@ -91,8 +95,9 @@ def check_hash(self):
9195
hashes.vthash()
9296
elif "VirusTotal_v2_Get_Observable" in result["name"]:
9397
print("-" * 120)
94-
print("[*] Try using VirusTotal_v3 for hashes"
95-
"instead of VirusTotal_v2!")
98+
print(
99+
"[*] Try using VirusTotal_v3 for hashes" "instead of VirusTotal_v2!"
100+
)
96101
elif "OTXQuery" in result["name"]:
97102
hashes = Hashes(result["report"], self.value)
98103
hashes.otxhash()
@@ -107,8 +112,7 @@ def check_ip(self):
107112
ips.vt_check()
108113
elif "VirusTotal_v3_Get_Observable" in result["name"]:
109114
print("-" * 120)
110-
print("[*] Try using VirusTotal_v2 for IPs"
111-
"instead of VirusTotal_v3!")
115+
print("[*] Try using VirusTotal_v2 for IPs" "instead of VirusTotal_v3!")
112116
elif "OTXQuery" in result["name"]:
113117
ips = Hybrid(result["report"], self.value)
114118
ips.otx_check()
@@ -195,7 +199,7 @@ def _vt_detected_samples(self, lst, colour):
195199
if len(lst) < 6:
196200
if "date" in j:
197201
print("\t\t====>".ljust(28), end=" ")
198-
print("Scan date:\t{}".format(j["date"]), )
202+
print("Scan date:\t{}".format(j["date"]),)
199203
print("\t\t====>".ljust(28), end=" ")
200204
print(
201205
"Detection:\t{0}{1}/{2}{3}{4}".format(
@@ -213,7 +217,7 @@ def _vt_detected_samples(self, lst, colour):
213217
while num <= 6:
214218
if "date" in j:
215219
print("\t\t====>".ljust(28), end=" ")
216-
print("Scan date:\t{}".format(j["date"]), )
220+
print("Scan date:\t{}".format(j["date"]),)
217221
print("\t\t====>".ljust(28), end=" ")
218222
print(
219223
"Detection:\t{0}{1}/{2}{3}{4}".format(
@@ -246,7 +250,7 @@ def _vt_detected_urls(self, lst, colour):
246250
print("\t\t====>".ljust(28), end=" ")
247251
print("URL:\t{}".format(j["url"]))
248252
print("\t\t====>".ljust(28), end=" ")
249-
print("Scan date:\t{}".format(j["scan_date"]), )
253+
print("Scan date:\t{}".format(j["scan_date"]),)
250254
print("\t\t====>".ljust(28), end=" ")
251255
print(
252256
"Detection:\t{0}{1}/{2}{3}{4}\n".format(
@@ -263,7 +267,7 @@ def _vt_detected_urls(self, lst, colour):
263267
print("\t\t====>".ljust(28), end=" ")
264268
print("URL:\t{}".format(j["url"]))
265269
print("\t\t====>".ljust(28), end=" ")
266-
print("Scan date:\t{}".format(j["scan_date"]), )
270+
print("Scan date:\t{}".format(j["scan_date"]),)
267271
print("\t\t====>".ljust(28), end=" ")
268272
print(
269273
"Detection:\t{0}{1}/{2}{3}{4}\n".format(
@@ -534,8 +538,11 @@ def _otx_get_general_info(self):
534538
pulses = self.text["pulses"]
535539
try:
536540
print("-" * 120)
537-
print(MyColors.Foreground.cyan, "\tReports found => {}\n".format(len(pulses)),
538-
MyColors.Foreground.lightgreen)
541+
print(
542+
MyColors.Foreground.cyan,
543+
"\tReports found => {}\n".format(len(pulses)),
544+
MyColors.Foreground.lightgreen,
545+
)
539546
num = 0
540547
for pulse in pulses:
541548
if pulse.get("name"):
@@ -556,24 +563,24 @@ def _otx_get_general_info(self):
556563
print("\t\t====>".ljust(28), end=" ")
557564
print(
558565
(
559-
MyColors.Foreground.orange
560-
+ "Tags: {0}{1}{2}".format(
561-
MyColors.Foreground.lightred,
562-
pulse["tags"],
563-
MyColors.reset,
564-
)
566+
MyColors.Foreground.orange
567+
+ "Tags: {0}{1}{2}".format(
568+
MyColors.Foreground.lightred,
569+
pulse["tags"],
570+
MyColors.reset,
571+
)
565572
)
566573
)
567574
if pulse.get("targeted_countries"):
568575
print("\t\t====>".ljust(28), end=" ")
569576
print(
570577
(
571-
MyColors.Foreground.orange
572-
+ "Targeted Countries: {0}{1}{2}".format(
573-
MyColors.Foreground.lightred,
574-
pulse["targeted_countries"],
575-
MyColors.reset,
576-
)
578+
MyColors.Foreground.orange
579+
+ "Targeted Countries: {0}{1}{2}".format(
580+
MyColors.Foreground.lightred,
581+
pulse["targeted_countries"],
582+
MyColors.reset,
583+
)
577584
)
578585
)
579586
if pulse.get("references"):
@@ -668,8 +675,8 @@ def ha_check(self):
668675
except ValueError:
669676
print(
670677
(
671-
MyColors.Foreground.red
672-
+ "Error while connecting to HybridAnalysis!\n"
678+
MyColors.Foreground.red
679+
+ "Error while connecting to HybridAnalysis!\n"
673680
)
674681
)
675682
except KeyError:
@@ -969,8 +976,11 @@ def _otx_get_general_info(self):
969976
if self.text["pulses"]:
970977
pulses = self.text["pulses"]
971978
try:
972-
print(MyColors.Foreground.cyan, "\tReports found => {}\n".format(len(pulses)),
973-
MyColors.Foreground.lightgreen)
979+
print(
980+
MyColors.Foreground.cyan,
981+
"\tReports found => {}\n".format(len(pulses)),
982+
MyColors.Foreground.lightgreen,
983+
)
974984
num = 0
975985
for pulse in pulses:
976986
if pulse.get("name"):
@@ -991,24 +1001,24 @@ def _otx_get_general_info(self):
9911001
print("\t\t====>".ljust(28), end=" ")
9921002
print(
9931003
(
994-
MyColors.Foreground.orange
995-
+ "Tags: {0}{1}{2}".format(
996-
MyColors.Foreground.lightred,
997-
pulse["tags"],
998-
MyColors.reset,
999-
)
1004+
MyColors.Foreground.orange
1005+
+ "Tags: {0}{1}{2}".format(
1006+
MyColors.Foreground.lightred,
1007+
pulse["tags"],
1008+
MyColors.reset,
1009+
)
10001010
)
10011011
)
10021012
if pulse.get("targeted_countries"):
10031013
print("\t\t====>".ljust(28), end=" ")
10041014
print(
10051015
(
1006-
MyColors.Foreground.orange
1007-
+ "Targeted Countries: {0}{1}{2}".format(
1008-
MyColors.Foreground.lightred,
1009-
pulse["targeted_countries"],
1010-
MyColors.reset,
1011-
)
1016+
MyColors.Foreground.orange
1017+
+ "Targeted Countries: {0}{1}{2}".format(
1018+
MyColors.Foreground.lightred,
1019+
pulse["targeted_countries"],
1020+
MyColors.reset,
1021+
)
10121022
)
10131023
)
10141024
if pulse.get("references"):
@@ -1200,10 +1210,8 @@ def _vt_get_scan_date(self):
12001210
def _vt_get_analysis_results(self):
12011211
print("-" * 120)
12021212
print("\n\n")
1203-
ct_malicious = MyColors.Foreground.lightred + str(
1204-
self.text["positives"]
1205-
)
1206-
ct_sources = MyColors.Foreground.lightgreen + str(self.text['total'])
1213+
ct_malicious = MyColors.Foreground.lightred + str(self.text["positives"])
1214+
ct_sources = MyColors.Foreground.lightgreen + str(self.text["total"])
12071215
print(f"Detection {ct_malicious}{MyColors.reset}/{ct_sources}")
12081216
print("_" * 20 + "\n")
12091217
print(MyColors.reset)
@@ -1219,21 +1227,33 @@ def _vt_get_analysis_results(self):
12191227
)
12201228

12211229
def _haus_general_info(self):
1222-
info = ['date_added', 'threat', 'reporter', 'url_status', 'urlhaus_reference']
1230+
info = ["date_added", "threat", "reporter", "url_status", "urlhaus_reference"]
12231231
for x, y in self.text.items():
12241232
if x in info:
1225-
print(MyColors.Foreground.lightgreen,
1226-
x + ":\t", MyColors.Foreground.cyan,
1227-
y, MyColors.reset)
1233+
print(
1234+
MyColors.Foreground.lightgreen,
1235+
x + ":\t",
1236+
MyColors.Foreground.cyan,
1237+
y,
1238+
MyColors.reset,
1239+
)
12281240

12291241
def _haus_payloads(self):
1230-
info = ["response_md5", "urlhaus_download", "file_type", "firstseen", "signature"]
1242+
info = [
1243+
"response_md5",
1244+
"urlhaus_download",
1245+
"file_type",
1246+
"firstseen",
1247+
"signature",
1248+
]
12311249

12321250
print("-" * 120)
1233-
print(MyColors.Foreground.lightcyan + "\nPayloads Found: {}"
1234-
.format(len(self.text['payloads'])))
1251+
print(
1252+
MyColors.Foreground.lightcyan
1253+
+ "\nPayloads Found: {}".format(len(self.text["payloads"]))
1254+
)
12351255
print("_" * 20)
1236-
payloads = self.text['payloads']
1256+
payloads = self.text["payloads"]
12371257
num = 0
12381258

12391259
for item in payloads:
@@ -1246,9 +1266,13 @@ def _haus_payloads(self):
12461266
for x, y in item.items():
12471267
if x in info:
12481268
print("\t\t====>".ljust(28), end=" ")
1249-
print(MyColors.Foreground.lightgreen, x + ":\t",
1250-
MyColors.Foreground.orange, y,
1251-
MyColors.reset)
1269+
print(
1270+
MyColors.Foreground.lightgreen,
1271+
x + ":\t",
1272+
MyColors.Foreground.orange,
1273+
y,
1274+
MyColors.reset,
1275+
)
12521276

12531277
def vturl_check(self):
12541278
print(MyColors.Foreground.lightblue + MyColors.Background.lightgrey)
@@ -1262,7 +1286,8 @@ def vturl_check(self):
12621286

12631287
except ValueError:
12641288
print(
1265-
MyColors.Foreground.lightred + "Error while connecting to VirusTotal!\n"
1289+
MyColors.Foreground.lightred
1290+
+ "Error while connecting to VirusTotal!\n"
12661291
)
12671292
else:
12681293
print(MyColors.Foreground.lightred + "No results found in VirusTotal!\n")
@@ -1278,7 +1303,8 @@ def hausurl_check(self):
12781303

12791304
except ValueError:
12801305
print(
1281-
MyColors.Foreground.lightred + "Error while connecting to URLHAUS!\n"
1306+
MyColors.Foreground.lightred
1307+
+ "Error while connecting to URLHAUS!\n"
12821308
)
12831309
else:
12841310
print(MyColors.Foreground.lightred + "\n\nNo results found in URLHAUS!\n")

pyintelowl/pyintelowl.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def session(self):
2828
session.headers.update(
2929
{
3030
"Authorization": "Token {}".format(str(self.token)),
31-
"User-Agent": "IntelOwlClient/1.3.1",
31+
"User-Agent": "IntelOwlClient/1.3.2",
3232
}
3333
)
3434
self._session = session
@@ -69,10 +69,10 @@ def send_file_analysis_request(
6969
private_job=False,
7070
disable_external_analyzers=False,
7171
run_all_available_analyzers=False,
72-
additional_configuration=None,
72+
runtime_configuration=None,
7373
):
74-
if additional_configuration is None:
75-
additional_configuration = {}
74+
if runtime_configuration is None:
75+
runtime_configuration = {}
7676
answer = {}
7777
errors = []
7878
try:
@@ -86,8 +86,8 @@ def send_file_analysis_request(
8686
"is_sample": True,
8787
"file_name": filename,
8888
}
89-
if additional_configuration:
90-
data["additional_configuration"] = additional_configuration
89+
if runtime_configuration:
90+
data["runtime_configuration"] = runtime_configuration
9191
files = {"file": (filename, binary)}
9292
url = self.instance + "/api/send_analysis_request"
9393
response = self.session.post(url, data=data, files=files)

pyintelowl/token_auth.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,11 @@ def __get_token(self):
3737
refresh = fp.read()
3838
# make sure token does exist
3939
if not refresh:
40-
logger.error(
41-
f"No API token specified in file: {self.token_file}"
42-
)
40+
logger.error(f"No API token specified in file: {self.token_file}")
4341
return None
4442
except FileNotFoundError:
4543
# No token file exists
46-
logger.error(
47-
f"No token file exists with given name: {self.token_file}"
48-
)
44+
logger.error(f"No token file exists with given name: {self.token_file}")
4945
return None
5046

5147
# refresh given token

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# This call to setup() does all the work
1111
setup(
1212
name="pyintelowl",
13-
version="1.3.1",
13+
version="1.3.2",
1414
description="Client and Library for Intel Owl",
1515
long_description=README,
1616
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)