forked from Mikbrosim/HackerWarsBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsoftwareExtractor.py
More file actions
53 lines (44 loc) · 2.26 KB
/
Copy pathsoftwareExtractor.py
File metadata and controls
53 lines (44 loc) · 2.26 KB
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
import json
try:
db = json.load(open("./softwares.json", "r"))
# CLEAN DATABASE
db = {ip:db[ip] for ip in db if db[ip] != "Invalid ip"}
json.dump(db , open("./softwares.json", "w+"))
except FileNotFoundError:
db = {}
finally:
print("Hacked Ips\n",[ip for ip in db if db[ip] != "Cracker not good enough"])
print("\nCracker not good enought to access\n",[ip for ip in db if db[ip] == "Cracker not good enough"],"\n")
# Extract best
bestversions = {"crc":0,"hash":0,"fwl":0,"vcol":0,"hdr":0,"skr":0,"vbrk":0,"av":0,"ftp":0,"ssh":0}
bestsoftwares = {}
for ip in db:
softwares = db[ip]
if isinstance(softwares, dict):
for softwareId in softwares:
software = softwares[softwareId]
for softwareType in bestversions:
if softwareType not in ["ftp","ssh"]:
if software["type"] == softwareType and float(software["version"]) > bestversions[softwareType]:
bestversions[softwareType] = float(software["version"])
bestsoftwares[softwareType] = "\t".join([softwareType, str(software["version"]), ip, softwareId, software["name"]])
else:
softwareIcon = "14" if softwareType == "ssh" else "13"
if "icon" not in software:
continue
if software["icon"] == softwareIcon and float(software["version"]) > bestversions[softwareType]:
bestversions[softwareType] = float(software["version"])
bestsoftwares[softwareType] = "\t".join([softwareType, str(software["version"]), ip, softwareId, software["name"]])
for softwareType in bestsoftwares:
print(bestsoftwares[softwareType])
#"""
# Print with threshold
print()
for ip in db:
softwares = db[ip]
if isinstance(softwares, dict):
for softwareId in softwares:
software = softwares[softwareId]
if software["type"] == "crc" and float(software["version"]) >= 2.5:
print("\t".join([softwares[softwareId]["type"], str(software["version"]), ip, software["name"], str(software["size"])]))
#"""