Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
StaticDet5 committed Jul 3, 2015
0 parents commit d4a13ec
Show file tree
Hide file tree
Showing 7 changed files with 234 additions and 0 deletions.
3 changes: 3 additions & 0 deletions MACAbnormal.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
S'<incomplete>'
p1
.
98 changes: 98 additions & 0 deletions MACKnown.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
(dp1
S'b4:79:a7:14:0b:c0'
p2
S'ESP8266-1'
p3
sS'40:0e:85:6b:44:75'
p4
S"Ty's Cellphone"
p5
sS'00:80:f0:c8:7d:f8'
p6
S'Camera 1'
p7
sS'00:80:f0:c8:7f:b5'
p8
S'Camera 2'
p9
sS'b8:27:eb:95:67:bc'
p10
S'OctoPi'
p11
sS'e0:3f:49:4a:ac:c6'
p12
S"Aly's Desktop"
p13
sS'30:85:a9:2f:45:21'
p14
S"Aly's Tablet"
p15
sS'44:e1:37:d6:b7:0a'
p16
S'Prob-Heather-FIOSTV'
p17
sS'd0:e7:82:f6:9b:b3'
p18
S'Office Chromecast'
p19
sS'2c:44:fd:62:1c:84'
p20
S"Ty's Work Laptop"
p21
sS'44:e1:37:d6:de:92'
p22
S'Upstairs-FIOSTV'
p23
sS'00:09:b0:ca:5d:6e'
p24
S'Onkyo-Receiver'
p25
sS'34:4d:f7:38:36:81'
p26
S"Aly's Cellphone"
p27
sS'6c:ca:08:02:ab:9b'
p28
S'IP-STB-4'
p29
sS'c8:a7:0a:9a:37:1f'
p30
S'Verizon Router'
p31
sS'c8:60:00:a1:c2:90'
p32
S"Ty's Desktop"
p33
sS'00:26:ab:f9:41:a3'
p34
S'Epson-printer'
p35
sS'24:a0:74:3b:a2:cf'
p36
S"Cynthia's iPad"
p37
sS'44:e1:37:ee:4f:6c'
p38
S'IP-STB-3'
p39
sS'b8:27:eb:a8:3c:a5'
p40
S'Raspberry Pi 1'
p41
sS'b8:27:eb:16:fa:52'
p42
S'raspberrypi2'
p43
sS'00:26:b9:ca:05:a0'
p44
S'Mini-Server'
p45
sS'ac:22:0b:a4:6c:c1'
p46
S"Ty's Tablet"
p47
sS'54:27:1e:86:04:4e'
p48
S'Ty-Laptop'
p49
s.
8 changes: 8 additions & 0 deletions MACSeen.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(lp1
S'e4:8b:7f:ac:bc:20'
p2
aS'3c:bd:d8:5d:d8:5b'
p3
aS'90:b6:86:ae:6c:42'
p4
a.
46 changes: 46 additions & 0 deletions checkFile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash python
import os,time
import cPickle as pickle

start = time.time()


fileSeen = 'MACSeen.txt'
fileKnown = 'MACKnown.txt'
newSeen = 'NewMACSeen.txt'
newKnown = {}
name = ""
seen = list(pickle.load(open(fileSeen, "rb")))
known = pickle.load(open(fileKnown, "rb"))

print "Valid names are at least 5 characters, without spaces"
print " "

for item in seen:
print "Do you have a name for this MAC? ", item
name = raw_input('Name>>> ')
if len(name) > 5:
newKnown[item] = name
seen.remove(item)
print known
print "-------------------------------------"
print newKnown
print "The above item(s) are going to be added to the pool of known MAC addresses, ok?"
confirmation = raw_input('Confirm yes, otherwise changes will be discarded> ')
confirmation.lower()
if confirmation == "y":
confirmation = "yes"
if confirmation == "yes":
known.update(newKnown)
else:
print "Changes discarded"
print "-------------------------------------"

pickle.dump(known, open(fileKnown, "wb"))
pickle.dump(seen, open(fileSeen, "wb"))


finish = time.time()
elapsed = finish - start
print "Report completed in ", elapsed, " seconds."

70 changes: 70 additions & 0 deletions initialtest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/bin/bash python
##import nmap
import os, time
import cPickle as pickle
##nm = nmap.PortScanner()
##scan = nm.scan('192.168.1.1-254', arguments='-sP -sS')
##print scan
start = time.time()
fileKnown = 'MACKnown.txt'
fileSeen = 'MACSeen.txt'
fileAbnormal = 'MACAbnormal.txt'

subnetping = os.popen('nmap -sP 192.168.1.0/24')
#print subnetping
known = pickle.load(open(fileKnown, "rb"))
seen = pickle.load(open(fileSeen, "rb"))
abnormal = pickle.load(open(fileAbnormal, "rb"))


allDevices = []
device = {}
knownCount = 0
unknownCount = 0
newCount = 0
issues = 0
unknownMACs = []

ar = os.popen('arp -a -v')
time.sleep(.25)
for line in ar.readlines():
#print line
item = line.split()
if item[3] in known:
print 'I know MAC ', item[3], ' is ', known[item[3]]
knownCount = knownCount+1
elif item[3] in seen:
print 'I have seen ', item[3], ' but I do not have more info. IP=', item[1], " it idenbtifies as: ", item[0]
unknownCount = unknownCount+1
unknownMACs.append(item[3])
elif item[3] in abnormal:
print 'There is something wrong at IP ', item[1], 'the MAC is ', item[3]
issues = issues + 1
else:
if item[0] != 'Entries:':
print 'I do not know MAC ', item[3] , ' at ', item[1]
newCount = newCount + 1
unknownMACs.append(item[3])

print "------------------------------------------------------"
print " "
print "There are ", knownCount, " recognized systems."
print "There are ", unknownCount, " systems that I have seen before, but cannot name."
print "There are ", newCount, " systems that I have not seen before."
print "And there are ", issues, "systems with issues."

seen = unknownMACs

pickle.dump(known, open(fileKnown, "wb"))
pickle.dump(seen, open(fileSeen, "wb"))
pickle.dump(abnormal, open(fileAbnormal,"wb"))

finish = time.time()
elapsed = finish - start
print "Report completed in ", elapsed, " seconds."






Binary file added initialtest.py.save
Binary file not shown.
9 changes: 9 additions & 0 deletions readme
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This is a python command line tool to probe and discover MAC's, IP's, and
hostnames on your network. The program "learns" over time, trying to remember
the systems that it has encountered before. You can run an additional
program checkfile.py to then give the systems an easy to remember name.

Eventually I would like this program to monitor my network for the comings and
goings of portable electronics, assisting in the identification of people
within my house and surrounding property.

0 comments on commit d4a13ec

Please sign in to comment.