Skip to content

Commit

Permalink
Replaced export from file to directory
Browse files Browse the repository at this point in the history
All the export function now no longer requires selecting the file. Now you can select the directory instead of a file.
  • Loading branch information
Anof-cyber authored Apr 10, 2022
1 parent be5ba4e commit ae84342
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions PentestMapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,11 @@ def deleterow(self,event):

row = self.logTable.getSelectedRows()
for rows in row:
logEntry = self._log[rows]
#logEntry = self._log[rows]
self._log.pop(rows)
self.fireTableDataChanged()
totalrow = self.logTable.getRowCount()
self.callbacks.printOutput(str(totalrow))
#totalrow = self.logTable.getRowCount()
#self.callbacks.printOutput(str(totalrow))



Expand Down Expand Up @@ -488,17 +488,25 @@ def getUiComponent(self):
def savelogger(self,e):
currenttime = str(time.strftime('%Y-%m-%d,%H:%M:%S', time.localtime(time.time())))
chooseFile = swing.JFileChooser()
chooseFile.setFileSelectionMode(swing.JFileChooser.DIRECTORIES_ONLY)
returnedFile = chooseFile.showDialog(self.buttonPanel2, "Output Path")

'''
filter = FileNameExtensionFilter("csv files", ["csv"])
chooseFile.addChoosableFileFilter(filter)
returnedFile = chooseFile.showDialog(self.buttonPanel2, "Choose File")
'''



if returnedFile == JFileChooser.APPROVE_OPTION:
fileLoad = chooseFile.getSelectedFile()
self.filepath = fileLoad.getAbsolutePath()
#self.filepath = fileLoad.getAbsolutePath()
self.filepath = fileLoad.getPath()
fname = "APIMapper"+str(time.time())+"."+"csv"
fnameWithPath = os.path.join(self.filepath,fname)

with open(self.filepath, 'wb') as loggerdata:
with open(fnameWithPath, 'wb') as loggerdata:
writer = csv.writer(loggerdata)
for logEntry in self._log:

Expand Down Expand Up @@ -606,14 +614,21 @@ def exportvulnerability(self,e):
self.callbacks.printOutput(str(totalrow))

chooseFile = swing.JFileChooser()
filter = FileNameExtensionFilter("csv files", ["csv"])
chooseFile.addChoosableFileFilter(filter)
returnedFile = chooseFile.showDialog(self.buttonPanel4, "Choose File")

chooseFile.setFileSelectionMode(swing.JFileChooser.DIRECTORIES_ONLY)
returnedFile = chooseFile.showDialog(self.buttonPanel4, "Output Path")
#filter = FileNameExtensionFilter("csv files", ["csv"])
#chooseFile.addChoosableFileFilter(filter)
#returnedFile = chooseFile.showDialog(self.buttonPanel4, "Choose File")

if returnedFile == JFileChooser.APPROVE_OPTION:
fileLoad1 = chooseFile.getSelectedFile()
self.filepath2 = fileLoad1.getAbsolutePath()
with open(self.filepath2, 'wb') as vulnerabilitydata:
self.filepath2 = fileLoad1.getPath()
fname2 = "Vulnerability"+str(time.time())+"."+"csv"
fnameWithPath = os.path.join(self.filepath2,fname2)

#self.filepath2 = fileLoad1.getAbsolutePath()
with open(fnameWithPath, 'wb') as vulnerabilitydata:
writer = csv.writer(vulnerabilitydata)
for row in range (0, totalrow):
url = self.dataModel2.getValueAt(row,0)
Expand Down

0 comments on commit ae84342

Please sign in to comment.