Skip to content

Commit

Permalink
Switch to Python 3
Browse files Browse the repository at this point in the history
Use print() instead of print
Fix indentation errors (inconsistent use of tabs and spaces in
indentation)
  • Loading branch information
sbrun committed Aug 25, 2021
1 parent 4c67b91 commit c563b3b
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions scripts/airgraph-ng/airodump-join
Expand Up @@ -2,13 +2,13 @@
# this script is a total hack it works and I'll clean it up later
import sys,getopt, optparse, pdb, re
def raw_lines(file):
try:
try:
raw_lines = open(file, "r")
except Exception:
print "Failed to open ",file,". Do you have the file name correct?"
print("Failed to open ",file,". Do you have the file name correct?")
sys.exit(1)
Rlines = raw_lines.readlines()
return Rlines
Rlines = raw_lines.readlines()
return Rlines

def parse_file(file,file_name):
cleanup = []
Expand All @@ -23,27 +23,27 @@ def parse_file(file,file_name):
try:
header = cleanup.index('BSSID, First time seen, Last time seen, channel, Speed, Privacy, Cipher, Authentication, Power, # beacons, # IV, LAN IP, ID-length, ESSID, Key')
stationStart = cleanup.index('Station MAC, First time seen, Last time seen, Power, # packets, BSSID, Probed ESSIDs')
del cleanup[header]
del cleanup[header]
except Exception:
print "You seem to have provided an improper input file"" '",file_name,"' ""Please make sure you are loading an airodump csv file and not a Pcap"
sys.exit(1)
print("You seem to have provided an improper input file"" '",file_name,"' ""Please make sure you are loading an airodump csv file and not a Pcap")
sys.exit(1)
Clients = cleanup[stationStart:] #splits off the clients into their own list
stationStart = stationStart - 1 #ulgy hack to make sure the heading gets deleted from end of the APs List
del cleanup[stationStart:]#removed all of the client info leaving only the info on available target AP's in ardump maybe I should create a new list for APs?
lines = [cleanup,Clients]
return lines
def join_write(data,name):
file = open(name,'a')
file = open(name,'a')
for line in data[0]:
line=line.rstrip()
if len(line)>1:
file.write(line+'\n')
line=line.rstrip()
if len(line)>1:
file.write(line+'\n')
for line in data [1]:
if len(line)>1:
file.write(line+'\n')
if len(line)>1:
file.write(line+'\n')
file.close()
def showBanner():
print "Airodump Joiner\nJoin Two Airodump CSV Files\n\n\t-i\tInput Files [ foo_name_1 foo_name_2 foo_name_3 .....] \n\t-o\tOutput File\n"
print("Airodump Joiner\nJoin Two Airodump CSV Files\n\n\t-i\tInput Files [ foo_name_1 foo_name_2 foo_name_3 .....] \n\t-o\tOutput File\n")

def file_pool(files):
AP = []
Expand All @@ -68,9 +68,9 @@ def sort_file(input):


if __name__ == "__main__":
if len(sys.argv) <= 1:
showBanner()
sys.exit(1)
if len(sys.argv) <= 1:
showBanner()
sys.exit(1)

parser = optparse.OptionParser("usage: %prog [options] arg1 arg2 arg3 .....")
parser.add_option("-o", "--output", dest="output",nargs=1, help="output file to write to")
Expand All @@ -80,11 +80,11 @@ if __name__ == "__main__":
filenames = options.filename
outfile = options.output
if outfile == None:
print "You must provide a file name to write out to. IE... -o foo.csv\n"
print("You must provide a file name to write out to. IE... -o foo.csv\n")
showBanner()
sys.exit(1)
elif filenames == None:
print "You must provide at least two file names to join. IE... -i foo1.csv foo2.csv\n"
print("You must provide at least two file names to join. IE... -i foo1.csv foo2.csv\n")
showBanner()
sys.exit(1)
for file_name in args:
Expand Down

0 comments on commit c563b3b

Please sign in to comment.