-
Notifications
You must be signed in to change notification settings - Fork 0
/
sharkscan.py
179 lines (97 loc) · 3.11 KB
/
sharkscan.py
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
import subprocess
from OuiLookup import OuiLookup
def dynamic(name, num, variable):
globals()[name + num] = variable
return name + num
def get_mac(mac):
return OuiLookup().query(mac)
def main_ray():
output = subprocess.getoutput("arp -a")
good_lines = []
cleaned_output = output.split("\n")
thing = -1
for x in cleaned_output[:]:
if "Interface" in x:
cleaned_output.remove(x)
if "Type" in x:
cleaned_output.remove(x)
for x in cleaned_output[:]:
if "Interface" in x:
cleaned_output.remove(x)
cleaned_output.pop(0)
l_cleaned_output = cleaned_output
thing = -1
thingo = -1
for x in cleaned_output[:]:
if x == '':
cleaned_output.remove('')
for x in cleaned_output[:]:
thing = thing + 1
x_copy = x
x_copy = x_copy.split(" ")
for nirgth in range(10):
try:
x_copy.remove('')
except:
for nigrgrg in range(10):
try:
x_copy.remove(' ')
except:
break
break
nameofvar = dynamic("Device", str(thing), x_copy)
for xax in range(thing):
thingo_wingo = globals()["Device" + str(xax)]
ilole = thingo_wingo[1].replace(" ", "")
thingo90 = ilole.replace('-', '').upper()
ress = str(thingo_wingo[0]) + str(", ") + str(get_mac(ilole)[0][thingo90]), str("," + thingo_wingo[2] + " IP")
good_lines.append(ress)
return str(good_lines), thing
def when_start():
window = Tk()
window.geometry("1000x350")
Text_to_change = StringVar()
Text_to_change2 = StringVar()
Text_to_change.set("""
Scanning and Updating....""")
Text_to_change2.set("")
Font_tuple = ("Bahnschrift", 20, "bold")
Title = Label(textvariable=Text_to_change2)
Title.configure(font = Font_tuple)
Title.pack()
label = Label(
textvariable=Text_to_change
)
label.pack()
if var.get() == 1:
print(var.get())
OuiLookup().update()
results, thing = main_ray()
result = results.replace("(", "\n")
result = result.replace(")", "")
result = result.replace("[", "")
result = result.replace("'", "")
Text_to_change.set(result)
Text_to_change2.set("""Hosts On Network:
""")
window.mainloop()
from tkinter import *
window = Tk()
window.geometry("500x250")
label = Label(
text="""SharkScan, The Network Scanner
""",
)
label.pack()
global var
var = IntVar()
button = Button(
text="Start Scanning",
width=25,
height=5,
command=lambda:[window.destroy(), when_start()]
)
c = Checkbutton(window, text = "Update MAC lookup table before scanning (may take time)?", variable=var)
c.pack()
button.pack()
window.mainloop()