You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I like to use your tool to organize all my scans. This is why, I often launch external tools from a term. I changed your code to realize a very useful function for me: "to copy the ip to the clipboard".
If you think, it could be interesting (and I assure you, it will) to add to your master. Here is the code:
controller.py (you need to install pyperclip => pip install pyperclip)
When you click from the host, it will only copy the ip address
import pyperclip
....
def getContextMenuForHost(self, isChecked, showAll=True): # showAll exists because in some cases we only want to show host tools excluding portscans and 'mark as checked'
menu = QMenu()
self.nmapSubMenu = QMenu('Portscan')
actions = []
for a in self.settings.hostActions:
if "nmap" in a[ 1] or "unicornscan" in a[1]:
actions.append(self.nmapSubMenu.addAction(a[0]))
else:
actions.append(menu.addAction(a[0]))
if showAll:
actions.append(self.nmapSubMenu.addAction("Run nmap (staged)"))
menu.addMenu(self.nmapSubMenu)
menu.addSeparator()
if isChecked == 'True':
menu.addAction('Mark as unchecked')
else:
menu.addAction('Mark as checked')
# MODIFIED HERE #
menu.addAction('Copy to clipboard')
return menu, actions
def handleHostAction(self, ip, hostid, actions, action):
if action.text() == 'Mark as checked' or action.text() == 'Mark as unchecked':
self.logic.toggleHostCheckStatus(ip)
self.view.updateInterface()
return
# MODIFIED HERE #
if action.text() == 'Copy to clipboard':
pyperclip.copy(ip)
And the same thing, when you click on a port, it will copy the "ip:port"
def getContextMenuForServiceName(self, serviceName='*', menu=None):
if menu == None: # if no menu was given, create a new one
menu = QMenu()
# MODIFIED HERE #
menu.addAction("Copy to clipboard")
if serviceName == '*' or serviceName in self.settings.general_web_services.split(","):
....
def handleServiceNameAction(self, targets, actions, action, restoring=True):
# MODIFIED HERE #
if action.text() == 'Copy to clipboard':
for ip in targets:
pyperclip.copy('%s:%s' % (ip[0],ip[1]))
....
It will be very useful to add this functionality to the master.
Thanks a lot.
The text was updated successfully, but these errors were encountered:
Hello, are you considering merging this enhancement by @AlessandroZ into the master branch? It works very well and is super useful, for reasons they've already mentioned.
Hi,
I like to use your tool to organize all my scans. This is why, I often launch external tools from a term. I changed your code to realize a very useful function for me: "to copy the ip to the clipboard".
If you think, it could be interesting (and I assure you, it will) to add to your master. Here is the code:
When you click from the host, it will only copy the ip address
And the same thing, when you click on a port, it will copy the "ip:port"
It will be very useful to add this functionality to the master.
Thanks a lot.
The text was updated successfully, but these errors were encountered: