a python programm to search sqlmap output
This commit is contained in:
go3ranh 2017-05-02 22:15:54 -07:00 committed by GitHub
parent a91a1be010
commit 2d26a1059d

64
test2.py Normal file
View File

@ -0,0 +1,64 @@
import os,csv,time
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
while True:
count = 0
path = 'goeranh'
print('\n\n\n\n')
print('enter the name(or fragments of it) of the file[leave blank to search all]')
fname = str(raw_input('->'))
print('enter a search string')
string = str(raw_input('->'))
time1 = time.time()
for path, dirs, files in os.walk('/home/%s/.sqlmap/output' % path):
for f in files:
if f.endswith('.csv'):
tempcount = count
print('')
print('\033[93m' + f + '\033[0m')
if(f.lower().find(fname.lower()) != -1):
#print os.path.join(path, f)
t = os.path.join(path, f)
with open(t) as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
for item in row:
if(item.lower().find(string.lower()) != -1):
count = count + 1
print(' \033[93m' + t + '\033[0m')
print('')
print(bcolors.HEADER + ' #! ' + item + ' !#' + bcolors.ENDC)
print('')
for j in row:
if(j.lower().find(string.lower()) != -1):
print('\033[91m' + j + '\033[0m -- '),
else:
print(j + ' -- '),
print('')
print('')
print('')
print('')
if(tempcount == count):
print('nothing found in this file')
print('')
print('\033[96m')
if(count == 0):
print('')
print('could not find your search string')
print('')
else:
print('')
print('')
print(str(count) + ' results in'),
time2 = time.time()
time3 = time2 - time1
print(str(time3) + " seconds")
print('\033[0m')