This repository has been archived by the owner on Mar 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getInstance.py
56 lines (43 loc) · 1.45 KB
/
getInstance.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from burp import IBurpExtender
from burp import IContextMenuFactory
from java.util import ArrayList
from javax.swing import JMenuItem
import socket
from java.awt.datatransfer import StringSelection
from java.awt import Toolkit
class BurpExtender(IBurpExtender, IContextMenuFactory):
def registerExtenderCallbacks( self, callbacks):
self._callback = callbacks
self._helpers = callbacks.getHelpers()
callbacks.setExtensionName("Depth Instance Info")
callbacks.registerContextMenuFactory(self)
return
def createMenuItems(self, invocation):
self.context = invocation
inv_context = invocation.getInvocationContext()
if inv_context == 7:
#not a valid menu
return
menuList = ArrayList()
menuItem = JMenuItem("Get Depth Instance", actionPerformed=self.getDepthInstance)
menuList.add(menuItem)
return menuList
def getDepthInstance(self, event):
message = []
message = self.context.getSelectedMessages()
try:
httpService = message[0].getHttpService()
host = httpService.getHost()
try:
ip = socket.gethostbyname(host)
except socket.error:
ip = 'Did Not Resolve'
print 'host not resolved'
protocol = httpService.getProtocol()
port = httpService.getPort()
except:
print 'Could not get service details'
instance = ip + ' / ' + ' ' + host + ': ' + 'tcp' + '/' + str(port) + '/' + protocol
s = StringSelection(instance)
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(s, s)
print instance