def getUiComponent(self): aws_access_key_id = self.callbacks.loadExtensionSetting( "aws_access_key_id") aws_secret_accesskey = self.callbacks.loadExtensionSetting( "aws_secret_access_key") if aws_access_key_id: self.aws_access_key_id = aws_access_key_id if aws_secret_accesskey: self.aws_secret_accesskey = aws_secret_accesskey self.panel = JPanel() self.main = JPanel() self.main.setLayout(BoxLayout(self.main, BoxLayout.Y_AXIS)) self.access_key_panel = JPanel() self.main.add(self.access_key_panel) self.access_key_panel.setLayout( BoxLayout(self.access_key_panel, BoxLayout.X_AXIS)) self.access_key_panel.add(JLabel('Access Key: ')) self.access_key = JTextField(self.aws_access_key_id, 25) self.access_key_panel.add(self.access_key) self.secret_key_panel = JPanel() self.main.add(self.secret_key_panel) self.secret_key_panel.setLayout( BoxLayout(self.secret_key_panel, BoxLayout.X_AXIS)) self.secret_key_panel.add(JLabel('Secret Key: ')) self.secret_key = JPasswordField(self.aws_secret_accesskey, 25) self.secret_key_panel.add(self.secret_key) self.target_host_panel = JPanel() self.main.add(self.target_host_panel) self.target_host_panel.setLayout( BoxLayout(self.target_host_panel, BoxLayout.X_AXIS)) self.target_host_panel.add(JLabel('Target host: ')) self.target_host = JTextField('example.com', 25) self.target_host_panel.add(self.target_host) self.buttons_panel = JPanel() self.main.add(self.buttons_panel) self.buttons_panel.setLayout( BoxLayout(self.buttons_panel, BoxLayout.X_AXIS)) self.save_button = JButton('Save Keys', actionPerformed=self.saveKeys) self.buttons_panel.add(self.save_button) self.enable_button = JButton('Enable', actionPerformed=self.enableGateway) self.buttons_panel.add(self.enable_button) self.disable_button = JButton('Disable', actionPerformed=self.disableGateway) self.buttons_panel.add(self.disable_button) self.disable_button.setEnabled(False) self.protocol_panel = JPanel() self.main.add(self.protocol_panel) self.protocol_panel.setLayout( BoxLayout(self.protocol_panel, BoxLayout.Y_AXIS)) self.protocol_panel.add(JLabel("Target Protocol:")) self.https_button = JRadioButton("HTTPS", True) self.http_button = JRadioButton("HTTP", False) self.protocol_panel.add(self.http_button) self.protocol_panel.add(self.https_button) buttongroup = ButtonGroup() buttongroup.add(self.https_button) buttongroup.add(self.http_button) self.regions_title = JPanel() self.main.add(self.regions_title) self.regions_title.add(JLabel("Regions to launch API Gateways in:")) self.regions_panel = JPanel() self.main.add(self.regions_panel) glayout = GridLayout(4, 3) self.regions_panel.setLayout(glayout) for region in AVAIL_REGIONS: cur_region = region.replace('-', '_') cur_region = cur_region + '_status' setattr(self, cur_region, JCheckBox(region, True)) attr = getattr(self, cur_region) self.regions_panel.add(attr) self.status = JPanel() self.main.add(self.status) self.status.setLayout(BoxLayout(self.status, BoxLayout.X_AXIS)) self.status_indicator = JLabel(DISABLED, JLabel.CENTER) self.status.add(self.status_indicator) self.panel.add(self.main) return self.panel
def build_projects_row(self): ''' Builds the projects row. ''' # Build own panel with SpringLayout. panel = JPanel() layout = SpringLayout() panel.setLayout(layout) # Create necessary components and add them to panel. project_label = JLabel('Project: ') self.right_combo = JComboBox() self.right_combo.setEditable(True) def create_project_list(): ''' Prepares list of projects and subprojects ordered with the default one first. ''' default_project = self.projects['default'][0].split('/')[0] if '/' in self.projects['default']: default_subproject = self.projects['default'].split('/')[1] else: default_subproject = '' projects = [default_project] subprojects = [default_subproject] # User created projects might not be in default dictionary for project in self.projects.keys(): if (project != default_project and project != 'default'): projects.append(project) # Default project might not have subproject if default_project in self.projects.keys(): if default_subproject: for subproject in self.projects[default_project]: if (subproject != default_subproject): subprojects.append(subproject) return projects, subprojects self.left_combo = JComboBox(create_project_list()[0]) # Make left combo keep size no matter how long project names are self.left_combo.setPreferredSize(Dimension(125, 30)) self.left_combo.setMinimumSize(self.left_combo.getPreferredSize()) self.left_combo.setMaximumSize(self.left_combo.getPreferredSize()) self.left_combo.setSize(self.left_combo.getPreferredSize()) self.right_combo = JComboBox(create_project_list()[1]) # Prevent right combo to change sizes dynamically self.right_combo.setPreferredSize(Dimension(100, 30)) self.right_combo.setMinimumSize(self.left_combo.getPreferredSize()) self.right_combo.setMaximumSize(self.left_combo.getPreferredSize()) self.right_combo.setSize(self.left_combo.getPreferredSize()) action_listener = ComboActionListener(self.right_combo, self.projects) self.left_combo.addActionListener(action_listener) self.left_combo.setEditable(True) self.right_combo.setEditable(True) slash_label = JLabel('/') tooltip_text = ("<html><body>Choose project from list or insert a new " "one.<br/>You can leave the right-hand field blank." "</body><html>") help_label = self.build_help_label(tooltip_text) panel.add(project_label) panel.add(self.left_combo) panel.add(slash_label) panel.add(self.right_combo) panel.add(help_label) # Set up constraints to tell panel how to position components. layout.putConstraint(SpringLayout.WEST, project_label, 15, SpringLayout.WEST, panel) layout.putConstraint(SpringLayout.NORTH, project_label, 18, SpringLayout.NORTH, panel) layout.putConstraint(SpringLayout.WEST, self.left_combo, 90, SpringLayout.WEST, panel) layout.putConstraint(SpringLayout.NORTH, self.left_combo, 15, SpringLayout.NORTH, panel) layout.putConstraint(SpringLayout.WEST, slash_label, 5, SpringLayout.EAST, self.left_combo) layout.putConstraint(SpringLayout.NORTH, slash_label, 18, SpringLayout.NORTH, panel) layout.putConstraint(SpringLayout.WEST, self.right_combo, 5, SpringLayout.EAST, slash_label) layout.putConstraint(SpringLayout.NORTH, self.right_combo, 15, SpringLayout.NORTH, panel) layout.putConstraint(SpringLayout.WEST, help_label, 5, SpringLayout.EAST, self.right_combo) layout.putConstraint(SpringLayout.NORTH, help_label, 18, SpringLayout.NORTH, panel) layout.putConstraint(SpringLayout.EAST, panel, 15, SpringLayout.EAST, help_label) layout.putConstraint(SpringLayout.SOUTH, panel, 10, SpringLayout.SOUTH, help_label) # Add this to NewAtf JFrame return panel
def registerExtenderCallbacks(self, callbacks): self.callbacks = callbacks self.helpers = callbacks.getHelpers() callbacks.setExtensionName("Missing Scanner Checks") self.out = callbacks.getStdout() # define all checkboxes self.cbPassiveChecks = self.defineCheckBox("Passive Scanner Checks") self.cbDOMXSS = self.defineCheckBox("DOM XSS", False) self.cbDOMXSSSources = self.defineCheckBox("Sources", False) self.cbDOMXSSSinks = self.defineCheckBox("Sinks") self.cbDOMXSSjQuerySinks = self.defineCheckBox("jQuery Sinks", False) self.grpDOMXSSSettings = JPanel() self.grpDOMXSSSettings.add(self.cbDOMXSSSources) self.grpDOMXSSSettings.add(self.cbDOMXSSSinks) self.grpDOMXSSSettings.add(self.cbDOMXSSjQuerySinks) self.cbSTS = self.defineCheckBox("Strict Transport Security") self.lblSTSMin = JLabel("Minimum acceptable max-age") self.inSTSMin = JTextField( str(STSMinimum), 9, actionPerformed=self.setSTSMinimum ) # TODO: actionPerformed only fires on enter key - focus lost would be better self.inSTSMin.setToolTipText( "Enter the minimum max-age value which is considered as acceptable. Press return to change setting!" ) self.grpSTSSettings = JPanel() self.grpSTSSettings.add(self.lblSTSMin) self.grpSTSSettings.add(self.inSTSMin) self.cbXCTO = self.defineCheckBox("Content Sniffing") self.cbXXP = self.defineCheckBox( "Client-side XSS Filter Configuration") self.cbRedirToHTTPS = self.defineCheckBox( "Redirection from HTTP to HTTPS") self.btnSave = JButton("Set as default", actionPerformed=self.saveConfig) self.btnRestore = JButton("Restore", actionPerformed=self.restoreConfig) self.grpConfig = JPanel() self.grpConfig.add(self.btnSave) self.grpConfig.add(self.btnRestore) self.restoreConfig() # definition of config tab self.tab = JPanel() layout = GroupLayout(self.tab) self.tab.setLayout(layout) layout.setAutoCreateGaps(True) layout.setAutoCreateContainerGaps(True) layout.setHorizontalGroup(layout.createSequentialGroup().addGroup( layout.createParallelGroup().addComponent(self.cbPassiveChecks) ).addGroup(layout.createParallelGroup().addComponent( self.cbDOMXSS).addComponent(self.cbSTS).addComponent( self.cbXCTO).addComponent(self.cbXXP).addComponent( self.cbRedirToHTTPS)).addGroup( layout.createParallelGroup().addComponent( self.grpDOMXSSSettings, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE).addComponent( self.grpSTSSettings, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE).addComponent( self.grpConfig, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))) layout.setVerticalGroup(layout.createSequentialGroup().addGroup( layout.createParallelGroup().addComponent( self.cbPassiveChecks).addComponent(self.cbDOMXSS).addComponent( self.grpDOMXSSSettings, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)).addGroup( layout.createParallelGroup().addComponent( self.cbSTS).addComponent( self.grpSTSSettings, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)).addComponent( self.cbXCTO).addComponent( self.cbXXP).addComponent( self.cbRedirToHTTPS).addComponent( self.grpConfig, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) self.domXSSSourcesRE = re.compile( "(location\s*[\[.])|([.\[]\s*[\"']?\s*(arguments|dialogArguments|innerHTML|write(ln)?|open(Dialog)?|showModalDialog|cookie|URL|documentURI|baseURI|referrer|name|opener|parent|top|content|self|frames)\W)|(localStorage|sessionStorage|Database)" ) # NOTE: done some optimizations here, original RE caused too much noise # - added leading dot in the first part - original recognized "<a href=..." etc. # - removed "value" in first part self.domXSSSinksRE = re.compile( "(\.(src|href|data|location|code|action)\s*[\"'\]]*\s*\+?\s*=)|((replace|assign|navigate|getResponseHeader|open(Dialog)?|showModalDialog|eval|evaluate|execCommand|execScript|setTimeout|setInterval)\s*[\"'\]]*\s*\()" ) self.domXSSjQuerySinksRE = re.compile( "after\(|\.append\(|\.before\(|\.html\(|\.prepend\(|\.replaceWith\(|\.wrap\(|\.wrapAll\(|\$\(|\.globalEval\(|\.add\(|jQUery\(|\$\(|\.parseHTML\(" ) self.headerSTSRE = re.compile( "^Strict-Transport-Security:.*?max-age=\"?(\d+)\"?", re.I) # TODO: multiple max-age directives cause confusion! self.headerXCTORE = re.compile( "^X-Content-Type-Options:\s*nosniff\s*$", re.I) self.headerXXP = re.compile( "^X-XSS-Protection:\s*(\d)(?:\s*;\s*mode\s*=\s*\"?(block)\"?)?", re.I) self.headerLocationHTTPS = re.compile( "^(?:Content-)?Location:\s*(https://.*)$", re.I) callbacks.registerScannerCheck(self) callbacks.addSuiteTab(self)
def output(self, value): eingabe = value.getString() if eingabe == "Lexikon": # Falls "Lexikon" an den Clienten übergeben wird, wird die GUI geöffnet, # in der man deutsche Wörter eingeben kann, die einem dann auf Englisch # vorgelesen werden. def change_text(event): text = feld.getText() x = suche(text) self.send(x) frame.visible = False frame = JFrame( 'Woerterbuch', defaultCloseOperation=JFrame.EXIT_ON_CLOSE, size=(380, 350), ) frame.setLayout(None) frame.visible = True hintergrund = ImageIcon("Hintergrund.jpg") hintergrundlabel = JLabel(hintergrund) frame.setContentPane(hintergrundlabel) uebersetzerlabel = JLabel() uebersetzerlabel.setForeground(Color(025, 025, 112)) uebersetzerlabel.setText( "<html><font size=+1>Welches Wort soll ich uebersetzen?</font></html>" ) uebersetzerlabel.setBounds(10, 20, 500, 50) frame.add(uebersetzerlabel) feld = JTextField() feld.setText("") feld.setBounds(20, 80, 300, 25) frame.add(feld) button = JButton('Uebersetzen', actionPerformed=change_text, size=(10, 20)) button.setBounds(20, 110, 300, 30) frame.add(button) if eingabe == "neue Lektion": # Falls dem Clienten "neue Lektion" übergeben wird, öffnet er er die # GUI für das Verwalten der Lektionen frame = JFrame('Lektion erstellen', defaultCloseOperation=JFrame.EXIT_ON_CLOSE, size=(1000, 1000)) frame.setLayout(None) def auflisten_in(ort): font = Font("Verdana", Font.BOLD, 15) liste_mit_Lektionen = [] with open(pfad, "r") as f: for line in f: liste_mit_Lektionen.append(line.strip()) liste_mit_Lektionen.sort() text = "" for lektion in liste_mit_Lektionen: text += lektion text += "\n" ort.setText(text) ort.setFont(font) frame.setLayout(None) uebersichtLabel = JLabel() def uebersetzen(event): frage = feld_frage.getText() x = suche(frage) feld_frage.setText(x) liste = [] with open(pfad, "r") as lektionen: for lektion in lektionen: if "nachgeschlagen" in lektion: liste.append(lektion) if liste: name = liste[-1] words = [] sql = "SELECT deutsch, englisch, symbol FROM " + name zeile = stmt.executeQuery(sql) while zeile.next(): d = zeile.getString("deutsch") e = zeile.getString("englisch") symb = zeile.getString("symbol") words.append((d, e, symb)) if len(words) < 50: sql = "INSERT INTO " + name + " (deutsch, englisch, symbol) VALUES(?,?,?);" pstmt = conn.prepareStatement(sql) pstmt.setString(1, frage) pstmt.setString(2, x) pstmt.setString(3, "X") pstmt.executeUpdate() else: namensteile = name.split("_") nummer = int(namensteile[1].strip()) + 1 name = "nachgeschlagen_" + str(nummer) test = "" with open(pfad, "r") as f: for line in f: test += line if not name in test: with open(pfad, "a") as f: f.write(name + "\n") sql = "CREATE TABLE " + name + " (deutsch text, englisch text, symbol text);" stmt.execute(sql) sql = "INSERT INTO " + name + " (deutsch, englisch, symbol) VALUES(?,?,?);" pstmt = conn.prepareStatement(sql) pstmt.setString(1, frage) pstmt.setString(2, x) pstmt.setString(3, "X") pstmt.executeUpdate() else: name = "nachgeschlagen_1" test = "" with open(pfad, "r") as f: for line in f: test += line if not name in test: with open(pfad, "a") as f: f.write(name + "\n") sql = "CREATE TABLE " + name + " (deutsch text, englisch text, symbol text);" stmt.execute(sql) sql = "INSERT INTO " + name + " (deutsch, englisch, symbol) VALUES(?,?,?);" pstmt = conn.prepareStatement(sql) pstmt.setString(1, frage) pstmt.setString(2, x) pstmt.setString(3, "X") pstmt.executeUpdate() auflisten_in(uebersicht) def delete(event): name = feld.getText() print name print self.geladen if name == self.geladen: count = 0 while tabelle.getValueAt(count, 0) != None: tabelle.setValueAt(None, count, 0) tabelle.setValueAt(None, count, 1) count += 1 stmt.execute("DROP TABLE " + name + ";") lektionen = [] with open(pfad, "r") as f: for line in f: lektion = line.strip() if not name == lektion: lektionen.append(lektion) with open(pfad, "w") as f: for lektion in lektionen: f.write(lektion + "\n") auflisten_in(uebersicht) def laden(event): name = feld.getText() self.geladen = name sql = "SELECT deutsch, englisch FROM " + name results = stmt.executeQuery(sql) count = 0 while results.next(): d = results.getString("deutsch") e = results.getString("englisch") tabelle.setValueAt(d, count, 0) tabelle.setValueAt(e, count, 1) count += 1 while tabelle.getValueAt(count, 0) != None: tabelle.setValueAt(None, count, 0) tabelle.setValueAt(None, count, 1) count += 1 def erstelle_Lektionstabelle(event): reihen = [] for i in range(0, 50): deutsch = tabelle.getValueAt(i, 0) englisch = tabelle.getValueAt(i, 1) if deutsch != None: symbol = "X" reihen.append([deutsch, englisch, symbol]) else: break z = 0 name = feld.getText() sql = "CREATE TABLE " + name + " (deutsch text, englisch text, symbol text);" try: stmt.execute(sql) except SQLError: stmt.execute("DROP TABLE " + name + ";") stmt.execute(sql) for reihe in reihen: print(reihe) deutsch = reihe[0] englisch = reihe[1] symbol = reihe[2] sql = "INSERT INTO " + name + " (deutsch, englisch, symbol) VALUES(?,?,?);" pstmt = conn.prepareStatement(sql) pstmt.setString(1, deutsch) pstmt.setString(2, englisch) pstmt.setString(3, symbol) pstmt.executeUpdate() test = "" with open(pfad, "r") as f: for line in f: test += line if not name in test: with open(pfad, "a") as f: f.write(name + "\n") self.send(name) frame.setVisible(False) frame = JFrame('Vokabel Listen', defaultCloseOperation=JFrame.EXIT_ON_CLOSE, size=(1000, 1000)) frame.setLayout(None) label_enter = JLabel() label_enter.setText( "<html><font size=+0.5 color = 000000>Bitte vor dem Speichern<br>die Entertaste bedienen</font></html>" ) label_enter.setBounds(20, 720, 250, 50) uebersichtLabel = JLabel() uebersichtLabel.setText( "<html><font size=+1 color=#191970>Bereits vorhandene Lektionen:</font></html>" ) uebersichtLabel.setBounds(450, 230, 250, 50) uebersicht = JTextArea() uebersicht.editable = False uebersicht_scroll = JScrollPane(uebersicht) uebersicht_scroll.viewport.view = uebersicht uebersicht_scroll.setBounds(450, 300, 250, 380) auflisten_in(uebersicht) button = JButton('Lektion speichern/Lektion reseten', actionPerformed=erstelle_Lektionstabelle, size=(10, 20)) button.setBounds(20, 700, 300, 30) button_laden = JButton('vorhandene Lektion laden', actionPerformed=laden, size=(10, 20)) button_laden.setBounds(20, 110, 210, 30) button_delete = JButton("Lektion entfernen", actionPerformed=delete) button_delete.setBounds(20, 140, 210, 30) hintergrund = ImageIcon("Hintergrund.jpg") pnl = JPanel() hintergrundlabel = JLabel(hintergrund) frame.setContentPane(hintergrundlabel) lektionsnamensLabel = JLabel() lektionsnamensLabel.setForeground(Color(025, 025, 112)) lektionsnamensLabel.setText( "<html><font size=+1>Hier bitte Namen der Lektion eingeben<br>(Nur ein Wort lang)</font></html>" ) lektionsnamensLabel.setBounds(10, 20, 500, 50) frame.add(lektionsnamensLabel) feld = JTextField() feld.setText("") feld.setBounds(20, 80, 210, 25) frame.add(feld) column_names = [ "<html><font size=+1 color=#191970><b>Deutsch</b></font></html>", "<html><font size=+1 color=#191970><b>Englisch</b></font></html>" ] table_model = DefaultTableModel(column_names, 50) tabelle = JTable(table_model) lektionsnamensLabel.setForeground(Color(025, 025, 112)) scrollbar = JScrollPane(tabelle) scrollbar.viewport.view = tabelle scrollbar.setVerticalScrollBarPolicy( scrollbar.VERTICAL_SCROLLBAR_ALWAYS) scrollbar.setVisible(True) tabelle.setVisible(True) scrollbar.setBounds(20, 190, 300, 490) feld_frage = JTextField() feld_frage.setText("") feld_frage.setBounds(450, 30, 300, 50) uebersetzerlabel = JLabel() uebersetzerlabel.setForeground(Color(025, 025, 112)) uebersetzerlabel.setText( "<html><font size=+1>Hier kannst Du ein deutsches Wort eintragen,<br>dass ich fuer Dich nachschlage</font></html>" ) uebersetzerlabel.setBounds(450, 80, 500, 50) button_uebersetzen = JButton('Uebersetzen', actionPerformed=uebersetzen, size=(10, 20)) button_uebersetzen.setBounds(450, 130, 300, 30) frame.add(button_uebersetzen) frame.add(uebersetzerlabel) frame.add(feld_frage) frame.add(feld) frame.add(scrollbar) frame.add(button) frame.add(button_laden) frame.setVisible(True) frame.add(uebersicht_scroll) frame.add(uebersichtLabel) frame.add(button_delete) frame.add(label_enter) elif eingabe == "alle Lektionen auflisten": # Hier erstellt der Client eine dynamische Grammatik # mit den vorhandenen Lektionen, die man sich abfragen lassen kann # und gibt diese wieder an DialogOS zurück. # Außerdem wird der Feedback Frame geöffnet. def auflisten_in2(ort): font = Font("Verdana", Font.BOLD, 15) liste_mit_Lektionen = [] with open(pfad, "r") as f: for line in f: liste_mit_Lektionen.append(line.strip()) liste_mit_Lektionen.sort() text = "" for lektion in liste_mit_Lektionen: text += lektion text += "\n" ort.setText(text) ort.setFont(font) frame_feedback.setVisible(True) auflisten_in2(uebersicht2) grammatik = "" grammatik = "root $NamevonLektion;\n" grammatik += "$NamevonLektion = " with open(pfad, "r") as f: z = 0 for line in f: if z == 0: if not "_" in line: grammatik += line else: zeile = line.split("_") grammatik += zeile[0] + " " grammatik += zeile[1].strip() else: if not "_" in line: grammatik += "|" + line else: zeile = line.split("_") grammatik += "|" + zeile[0] + " " grammatik += zeile[1].strip() if line != "\n": z += 1 grammatik += ";" self.send(grammatik) elif "sende" in eingabe: # DialogOS sagt dem Clienten, welche Lektion der User abgefragt # werden möchte. Der Client ließt dann die entsprechende Lektion # aus der Datenbank aus und gibt eine Liste mit 2 Listen zurück. # In der ersten Liste befinden sich die deutschen Bedeutungen, der # noch nicht gewussten Wörter, in der 2. Liste die englsichen Bedeutungen. # Falls alle Wörter bereits gekonnt wurden, wird stattdessen eine entsprechende # Anmerkung an DialogOS geschickt und DialogOS informiert den User darüber. z = 0 if "nachgeschlagen" in eingabe: bestandteile = eingabe.split() name = bestandteile[1] + "_" + bestandteile[2] else: name = eingabe.split()[1] sql = "SELECT deutsch, englisch, symbol FROM " + name vokabelliste = stmt.executeQuery(sql) deutsch = [] englisch = [] symbol = [] while (vokabelliste.next()): deutsch.append(vokabelliste.getString("deutsch")) englisch.append(vokabelliste.getString("englisch")) symbol.append(vokabelliste.getString("symbol")) indices = range(0, len(deutsch)) random.shuffle(indices) vokabeln = [[], []] for index in indices: d = deutsch[index] e = englisch[index] s = symbol[index] if s == "X": vokabeln[0].append(d) vokabeln[1].append(e) if vokabeln[0]: self.send(vokabeln) else: self.send([ "Du kannst diese Lektion schon komplett. Wenn Du sie wieder abgefragt werden willst, resete sie bitte unter Wokabeln verwalten." ]) else: # Dieser Teil des Codes wird während der Abfrage ausgeführt. # Nach jeder neuen Vokabel wird dann in ein Feld im Feedback # Frame die deutsche, die englische Vokabel und ein Symbol angezeigt, # welches einen darüber informiert, ob man die Vokabel wusste, oder nicht. # (O für gewusst und X für nicht gewusst) nametext = eingabe.split(":") name = nametext[0] text = nametext[1] feld_feedback.setText(text) zeilen = text.split("\n") symb = zeilen[-2].split("\t")[-1] d = zeilen[-2].split("\t")[-3] print d sql = "UPDATE " + name + " SET symbol = ? WHERE deutsch = ?" pstmt = conn.prepareStatement(sql) pstmt.setString(1, symb) pstmt.setString(2, d) pstmt.executeUpdate()
def registerExtenderCallbacks(self, callbacks): endianVal = 0 def generateTextBox(defaultTxt, editable): sample = JTextArea(5, 20) scrollPane1 = JScrollPane(sample) sample.setBounds(0, 0, 400, 400) sample.setEditable(editable) sample.setLineWrap(True) sample.setWrapStyleWord(True) sample.setBorder(BorderFactory.createLineBorder(Color.BLACK)) sample.setText(defaultTxt) return sample def decodeData(event): #Get Base64 token full_str = base64.b64decode(self._left_tb1.getText()) sha_mac = full_str[44:64].encode('hex') inflate_data = full_str[76:] data = zlib.decompress(inflate_data) user_length = data[20] loc = 21 tokenDetails = "User name :" + data[ loc:loc + int(user_length.encode('hex'), 16)].replace( "\x00", "") + "\n" loc = loc + int(user_length.encode('hex'), 16) lang_length = data[loc] loc = loc + 1 tokenDetails += "Lang Code :" + data[ loc:loc + int(lang_length.encode('hex'), 16)].replace( "\x00", "") + "\n" tmp1.setText(data[loc:loc + int(lang_length.encode('hex'), 16)].replace( "\x00", "")) loc = loc + int(lang_length.encode('hex'), 16) node_length = data[loc] loc = loc + 1 tokenDetails += "Node name :" + data[ loc:loc + int(node_length.encode('hex'), 16)].replace( "\x00", "") + "\n" tmp2.setText(data[loc:loc + int(node_length.encode('hex'), 16)].replace( "\x00", "")) loc = loc + int(node_length.encode('hex'), 16) time_length = data[loc] loc = loc + 1 tokenDetails += "Creation time :" + data[ loc:loc + int(time_length.encode('hex'), 16)].replace( "\x00", "") tmp = data[loc:loc + int(time_length.encode('hex'), 16)].replace( "\x00", "") datestamp = tmp[:len(tmp) - 7] tmp3.setText(datestamp) # Determine if it's little or big endian if (data[4:8].encode('hex') == '04030201'): endianVal = 0 else: endianVal = 1 tmp4.setText(str(endianVal)) hashcatFormat = sha_mac + ":" + data.encode("hex") left_tb2.setText(tokenDetails) left_tb3.setText(hashcatFormat) def make_field(part, size): part = chr(len(part) + size) + part return part def generateToken(event): newtoken = "" endianVal = int(tmp4.getText()) if endianVal == 1: username = right_tb2.getText().encode('utf_16_be') nodepw = right_tb1.getText().encode('utf_16_le') lang = tmp1.getText().encode('utf_16_be') nodename = tmp2.getText().encode('utf_16_be') datestamp = (tmp3.getText() + '.164266').encode('utf_16_be') token_ver = "8.10".encode('utf_16_be') unknown_field = "N".encode('utf_16_be') uncompressed_data = '\x01\x02\x03\x04\x00\x01\x00\x00\x00\x00\x02\xbc\x00\x00\x00\x00' + make_field( username, 0) + make_field(lang, 0) + make_field( nodename, 0) + make_field(datestamp, 0) + '\x00' uncompressed_field = '\x00\x00\x00' + make_field( uncompressed_data, 4) inflate_data = zlib.compress(uncompressed_field) sha1_mac = hashlib.sha1(uncompressed_field + nodepw).digest() uncompressed_length = chr(len(uncompressed_field)) static_headers1 = '\x01\x02\x03\x04\x00\x01\x00\x00\x00\x00\x02\xbc\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x04\x53\x68\x64\x72\x02' + unknown_field + uncompressed_length + '\x08' + token_ver + '\x14' static_headers2 = '\x00\x05\x53\x64\x61\x74\x61' body = '\x00\x00\x00' + make_field( static_headers2 + make_field(inflate_data, 0), 4) token = '\x00\x00\x00' + make_field( static_headers1 + sha1_mac + body, 4) newtoken = base64.b64encode(token) elif endianVal == 0: username = right_tb2.getText().encode('utf_16_le') nodepw = right_tb1.getText().encode('utf_16_le') lang = tmp1.getText().encode('utf_16_le') nodename = tmp2.getText().encode('utf_16_le') datestamp = (tmp3.getText() + '.999543').encode('utf_16_le') token_ver = "8.10".encode('utf_16_le') unknown_field = "N".encode('utf_16_le') uncompressed_data = '\x00\x00\x00\x04\x03\x02\x01\x01\x00\x00\x00\xbc\x02\x00\x00\x00\x00\x00\x00' + make_field( username, 0) + make_field(lang, 0) + make_field( nodename, 0) + make_field(datestamp, 0) + '\x00' uncompressed_field = make_field(uncompressed_data, 1) inflate_data = zlib.compress(uncompressed_field) sha1_mac = hashlib.sha1(uncompressed_field + nodepw).digest() uncompressed_length = chr(len(uncompressed_field)) static_headers1 = '\x00\x00\x00\x04\x03\x02\x01\x01\x00\x00\x00\xbc\x02\x00\x00\x00\x00\x00\x00\x2c\x00\x00\x00\x04\x00\x53\x68\x64\x72\x02' + unknown_field + uncompressed_length + '\x08' + token_ver + '\x14' static_headers2 = '\x00\x00\x00\x05\x00\x53\x64\x61\x74\x61' body = make_field( static_headers2 + make_field(inflate_data, 0), 1) token = make_field(static_headers1 + sha1_mac + body, 1) newtoken = base64.b64encode(token) right_tb3.setText("PS_TOKEN=" + newtoken + ";") # keep a reference to our callbacks object self._callbacks = callbacks # obtain an extension helpers object self._helpers = callbacks.getHelpers() # set our extension name callbacks.setExtensionName("PeopleSoft PSToken Processor") # main split pane self._splitpane = JSplitPane(JSplitPane.HORIZONTAL_SPLIT) self._splitpane.setResizeWeight(0.5) c = GridBagConstraints() c.weightx = 1 c.weighty = 1 c.anchor = GridBagConstraints.NORTHWEST #Temp variables tmp1 = JLabel("tmp") tmp2 = JLabel("tmp") tmp3 = JLabel("tmp") tmp4 = JLabel("tmp") # add left panel panel1 = JPanel(GridBagLayout()) header1 = JLabel("EXTRACTION") header1.setFont(Font("Myriad Pro", Font.BOLD, 24)) left_t1 = JLabel("PS_TOKEN Cookie") left_t2 = JLabel("Token Details") left_t3 = JLabel("Token Hash + Salt (Hashcat Format)") left_t4 = JLabel( "Save this into a .hash file and run the following Hashcat command: hashcat -m 13500 <hashfile> <dictionary file>" ) self._left_tb1 = generateTextBox("Your PS_TOKEN value here", True) left_tb2 = generateTextBox("Token Details here", False) left_tb3 = generateTextBox("Hashcat format here", False) btnDecode = JButton("Decode", actionPerformed=decodeData) btnGenerate = JButton("Generate", actionPerformed=generateToken) #add right panel panel2 = JPanel(GridBagLayout()) header2 = JLabel("GENERATION") header2.setFont(Font("Myriad Pro", Font.BOLD, 24)) right_t1 = JLabel("Node password") right_t2 = JLabel("New username") right_t3 = JLabel("New Base64 PS_TOKEN") right_t4 = JLabel( "Match & Replace rule to modify PS_TOKEN (Type: Request Header, enable regex)" ) right_t5 = JLabel("Match rule: PS_TOKEN=[A-Za-z0-9\/\+]*;") right_t6 = JLabel("Replace: PS_TOKEN=<new generated PS_TOKEN>;") right_tb1 = generateTextBox("Password here", True) right_tb2 = generateTextBox("PSADMIN", True) right_tb3 = generateTextBox("Your new token here", False) panel1.add(header1, c) panel2.add(header2, c) c.gridx = 0 c.gridy = 1 panel1.add(left_t1, c) panel2.add(right_t1, c) c.gridy += 1 panel1.add(self._left_tb1, c) panel2.add(right_tb1, c) c.gridy += 1 panel1.add(left_t2, c) panel2.add(right_t2, c) c.gridy += 1 panel1.add(left_tb2, c) panel2.add(right_tb2, c) c.gridy += 1 panel1.add(left_t3, c) panel2.add(right_t3, c) c.gridy += 1 panel1.add(left_t4, c) panel2.add(right_t4, c) c.gridy += 1 panel1.add(left_tb3, c) panel2.add(right_t5, c) c.gridy += 1 panel2.add(right_t6, c) c.gridy += 1 panel2.add(right_tb3, c) c.gridy += 1 panel1.add(btnDecode, c) panel2.add(btnGenerate, c) self._splitpane.setLeftComponent(panel1) self._splitpane.setRightComponent(panel2) # customize our UI components callbacks.customizeUiComponent(self._splitpane) #callbacks.customizeUiComponent(panel1) #callbacks.customizeUiComponent(scrollPane) # add the custom tab to Burp's UI callbacks.addSuiteTab(self) #add option to do right-click callbacks.registerContextMenuFactory(self) return
if 3 == col: old = self.getValueAt(row, col) if old == value: return # else, update value in the underlying data structure accepted[row] = value # ... and save the evaluation CSV file in a new thread # to avoid potentially slow operations in the event dispatch thread t = Thread(writeAccepted) t.setPriority(Thread.NORM_PRIORITY) t.start() # Create the UI: a 3-column table and a text area next to it # to show the Motivation column of any selected row: all = JPanel() gb = GridBagLayout() all.setLayout(gb) c = GridBagConstraints() table = JTable(TableModel()) table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION) table.setAutoCreateRowSorter(True) # to sort the view only, not the data in the underlying TableModel jsp = JScrollPane(table) jsp.setPreferredSize(Dimension(200, 500)) c.anchor = GridBagConstraints.NORTHWEST c.fill = GridBagConstraints.BOTH # resize with the frame gb.setConstraints(jsp, c) all.add(jsp) c.gridx = 1 c.weightx = 1.0 # take any additionally available horizontal space c.weighty = 1.0
def initUI(self): menubar = JMenuBar() start = JMenu("Start") start.setMnemonic(KeyEvent.VK_S) apps = JMenu("Applications") apps.setPreferredSize(Dimension(200, 35)) apps.setToolTipText("Stylus Applications") web = JMenuItem("Internet", actionPerformed=self.internet) web.setPreferredSize(Dimension(200, 35)) web.setToolTipText("Stylus Web Browser") apps.add(web) image = JMenuItem("Image Viewer", actionPerformed=self.photos) image.setPreferredSize(Dimension(200, 35)) image.setToolTipText("Stylus Image Viewer") apps.add(image) start.add(apps) utility = JMenu("Utility") utility.setPreferredSize(Dimension(200, 35)) utility.setToolTipText("Stylus Utility") voice = JMenuItem("Anna", actionPerformed=self.vocal) voice.setPreferredSize(Dimension(200, 35)) voice.setToolTipText("Anna Vocal Assistant") utility.add(voice) clc = JMenuItem("Calculator", actionPerformed=self.calc) clc.setPreferredSize(Dimension(200, 35)) clc.setToolTipText("Stylus Calculator") utility.add(clc) fman = JMenuItem("File Manager", actionPerformed=self.file_manager) fman.setPreferredSize(Dimension(200, 35)) fman.setToolTipText("Stylus File Manager") utility.add(fman) txted = JMenuItem("Notepad", actionPerformed=self.notepad) txted.setPreferredSize(Dimension(200, 35)) txted.setToolTipText("Stylus Notepad") utility.add(txted) terminal = JMenuItem("Terminal (as root)", actionPerformed=self.lxterminal) terminal.setPreferredSize(Dimension(200, 35)) terminal.setToolTipText("Stylus Terminal") utility.add(terminal) start.add(utility) games = JMenu("Games") games.setPreferredSize(Dimension(200, 35)) games.setToolTipText("PyOS Games") g1 = JMenuItem("2048", actionPerformed=self.d2048) g1.setPreferredSize(Dimension(200, 35)) g1.setToolTipText("Play 2048 Game") games.add(g1) g2 = JMenuItem("Ping Pong", actionPerformed=self.ppong) g2.setPreferredSize(Dimension(200, 35)) g2.setToolTipText("Play Ping Pong Game") games.add(g2) start.add(games) start.addSeparator() exit = JMenuItem("Exit", actionPerformed=self.onExit) exit.setPreferredSize(Dimension(200, 35)) exit.setToolTipText("Stylus Exit") start.add(exit) menubar.add(start) file = JMenu("File") file.setMnemonic(KeyEvent.VK_F) tk = Toolkit.getDefaultToolkit() xSize = (int(tk.getScreenSize().getWidth())) ySize = (int(tk.getScreenSize().getHeight())) self.setSize(xSize, ySize) filebg = open("/icons/background.txt", "r") path = filebg.readline() filebg.close() panel2 = bg.background(path, self.getWidth(), self.getHeight() - 100) theme = JMenuItem("Change background", actionPerformed=lambda e: self.bg(panel2, e)) theme.setPreferredSize(Dimension(200, 35)) theme.setToolTipText("Stylus Background") file.add(theme) menubar.add(file) info = JMenu("?") info.setMnemonic(KeyEvent.VK_I) inf = JMenuItem("Info", actionPerformed=self.onInfo) inf.setToolTipText("Stylus Information") info.add(inf) menubar.add(info) menubar.add(Box.createHorizontalGlue()) timedate = JMenu(time.strftime("%a, %Y %b %d, %H:%M")) timedate.setMnemonic(KeyEvent.VK_C) calendar = JMenuItem("Calendar", actionPerformed=self.calendar) calendar.setPreferredSize(Dimension(200, 35)) timedate.add(calendar) menubar.add(timedate) menubar.add(JLabel(" ")) menubar.setPreferredSize(Dimension(200, 35)) self.setJMenuBar(menubar) self.setTitle("Stylus OS") self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) #self.setSize(1360, 768) self.setLocationRelativeTo(None) """time = JPanel() time.setBorder(BorderFactory.createEtchedBorder()) time.setBackground(Color(153, 203, 255)) time.setLayout(GridLayout(0, 1)) f = Font("", Font.PLAIN, 60) t = JLabel("11:51") t.setHorizontalAlignment(JLabel.CENTER) t.setFont(f) time.add(t) f2 = Font("", Font.PLAIN, 50) d = JLabel("Tuesday, 2016/07/12") d.setHorizontalAlignment(JLabel.CENTER) d.setFont(f2) time.add(d) self.getContentPane().add(time) self.add(time, BorderLayout.NORTH)""" panel = JPanel() self.getContentPane().add(panel) b0 = JButton(ImageIcon("/icons/file-manager.png"), actionPerformed=self.file_manager) b0.setToolTipText("File Manager") panel.add(b0) b1 = JButton(ImageIcon("/icons/internet.png"), actionPerformed=self.internet) b1.setToolTipText("Internet") panel.add(b1) b2 = JButton(ImageIcon("/icons/mail.png")) b2.setToolTipText("Mail") #panel.add(b2) b3 = JButton(ImageIcon("/icons/music.png")) b3.setToolTipText("Music") #panel.add(b3) b4 = JButton(ImageIcon("/icons/video.png")) b4.setToolTipText("Video") #panel.add(b4) b5 = JButton(ImageIcon("/icons/photos.png"), actionPerformed=self.photos) b5.setToolTipText("Photos") panel.add(b5) b6 = JButton(ImageIcon("/icons/calculator.png"), actionPerformed=self.calc) b6.setToolTipText("Calculator") panel.add(b6) b7 = JButton(ImageIcon("/icons/notepad.png"), actionPerformed=self.notepad) b7.setToolTipText("Notepad") panel.add(b7) b8 = JButton(ImageIcon("/icons/settings.png")) b8.setToolTipText("Settings") #panel.add(b8) b9 = JButton(ImageIcon("/icons/trash.png")) b9.setToolTipText("Trash") #panel.add(b9) #panel.setBackground(Color(153, 203, 255)) self.add(panel, BorderLayout.SOUTH) self.getContentPane().add(panel2) #panel2.setBorder(BorderFactory.createEtchedBorder()) #panel2.setLayout(GridLayout(0, 1)) #panel.setLayout(None) #panel2.setBackground(Color(153, 203, 255)) #panel2.add(JLabel(ImageIcon("logo.png"))) #panel2.add(JButton("Icon 0")) #panel2.add(JButton("Icon 1")) #panel2.add(JButton("Icon 2")) #panel2.add(JButton("Icon 3")) #panel2.add(JButton("Icon 4")) #panel2.add(JButton("Icon 5")) #panel2.add(JButton("Icon 6")) #panel2.add(JButton("Icon 7")) #panel2.add(JButton("Icon 8")) #panel2.add(JButton("Icon 9")) self.add(panel2) self.setExtendedState(JFrame.MAXIMIZED_BOTH) self.setUndecorated(True) self.setVisible(True)
def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout(self.gbPanel0) self.Error_Message = JLabel("") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 31 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Error_Message, self.gbcPanel0) self.panel0.add(self.Error_Message) # self.Label_1 = JLabel("MacFSEvents To Include:") # self.Label_1.setEnabled(True) # self.gbcPanel0.gridx = 2 # self.gbcPanel0.gridy = 1 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 0 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) # self.panel0.add( self.Label_1 ) # self.Blank_1 = JLabel( " ") # self.Blank_1.setEnabled(True) # self.gbcPanel0.gridx = 2 # self.gbcPanel0.gridy = 5 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 0 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.Blank_1, self.gbcPanel0 ) # self.panel0.add( self.Blank_1 ) # self.Plugin_list = ('FolderEvent','Mount','Unmount','EndOfTransaction','LastHardLinkRemoved','HardLink', \ # 'SymbolicLink','FileEvent','PermissionChange','ExtendedAttrModified','ExtendedAttrRemoved', \ # 'DocumentRevisioning','Created','Removed','InodeMetaMod','Renamed','Modified', \ # 'Exchange','FinderInfoMod','FolderCreated') # self.Plugin_LB = JList( self.Plugin_list, valueChanged=self.onchange_plugins_lb) # self.Plugin_LB.setVisibleRowCount( 7 ) # self.scpPlugin_LB = JScrollPane( self.Plugin_LB ) # self.gbcPanel0.gridx = 2 # self.gbcPanel0.gridy = 7 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 1 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.scpPlugin_LB, self.gbcPanel0 ) # self.panel0.add( self.scpPlugin_LB ) self.Blank_4 = JLabel(" ") self.Blank_4.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 17 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Blank_4, self.gbcPanel0) self.panel0.add(self.Blank_4) # self.Label_3 = JLabel( "Message:") # self.Label_3.setEnabled(True) # self.gbcPanel0.gridx = 2 # self.gbcPanel0.gridy = 29 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 0 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.Label_3, self.gbcPanel0 ) # self.panel0.add( self.Label_3 ) self.add(self.panel0)
def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout( self.gbPanel0 ) self.LabelA = JLabel("VirusTotal API Key:") self.LabelA.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 1 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.LabelA, self.gbcPanel0 ) self.panel0.add( self.LabelA ) self.API_Key_TF = JTextField(20) self.API_Key_TF.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.API_Key_TF, self.gbcPanel0 ) self.panel0.add( self.API_Key_TF ) self.Blank_1 = JLabel( " ") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 6 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_1, self.gbcPanel0 ) self.panel0.add( self.Blank_1 ) self.Private_API_Key_CB = JCheckBox("Private API Key?", actionPerformed=self.checkBoxEvent) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Private_API_Key_CB, self.gbcPanel0 ) self.panel0.add( self.Private_API_Key_CB ) self.Save_Settings_BTN = JButton( "Save Settings", actionPerformed=self.SaveSettings) self.Save_Settings_BTN.setEnabled(True) self.rbgPanel0.add( self.Save_Settings_BTN ) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 8 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Save_Settings_BTN, self.gbcPanel0 ) self.panel0.add( self.Save_Settings_BTN ) self.Label_1 = JLabel( "Error Message:") self.Label_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) self.panel0.add( self.Label_1 ) self.Error_Message = JLabel( "") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) self.panel0.add( self.Error_Message ) self.add(self.panel0)
def run( self ) : #----------------------------------------------------------------------- # Size the frame to use 1/2 of the screen #----------------------------------------------------------------------- screenSize = Toolkit.getDefaultToolkit().getScreenSize() frameSize = Dimension( screenSize.width >> 1, screenSize.height >> 1 ) frame = JFrame( 'javadocInfo_10', size = frameSize, defaultCloseOperation = JFrame.EXIT_ON_CLOSE ) #----------------------------------------------------------------------- # Reposition the frame to be in the center of the screen #----------------------------------------------------------------------- frame.setLocation( ( screenSize.width - frameSize.width ) >> 1, ( screenSize.height - frameSize.height ) >> 1 ) #----------------------------------------------------------------------- # Initialize the list to have exactly 1 element #----------------------------------------------------------------------- model = DefaultListModel() model.addElement( 'One moment please...' ) self.List = JList( model, valueChanged = self.pick, selectionMode = ListSelectionModel.SINGLE_SELECTION ) #----------------------------------------------------------------------- # Put the List in a ScrollPane and place it in the middle of a pane #----------------------------------------------------------------------- pane = JPanel( layout = BorderLayout() ) pane.add( JScrollPane( self.List, minimumSize = ( 300, 50 ) ), BorderLayout.CENTER ) #----------------------------------------------------------------------- # Add a TextField [for the URL of the selected entry] at the bottom #----------------------------------------------------------------------- self.text = JTextField( 'Enter text...', caretUpdate = self.caretUpdate ) pane.add( self.text, BorderLayout.SOUTH ) #----------------------------------------------------------------------- # Add the pane and a scrollable TextArea to a SplitPane in the frame #----------------------------------------------------------------------- self.area = JEditorPane( 'text/html', '<html><h3>Nothing selected</h3></html>', editable = 0 ) self.splitPane = JSplitPane( JSplitPane.HORIZONTAL_SPLIT, pane, self.area ) self.splitPane.setDividerLocation( 234 ) frame.add( self.splitPane ) #----------------------------------------------------------------------- # Create a separate thread to locate & proces the remote URL #----------------------------------------------------------------------- self.Links = {} # Initialize the Links dictionary self.classes = None # complete list of all classes found soupTask( self.List, # The visible JList instance self.text, # User input field JAVADOC_URL, # Remote web page URL to be processed self.Links, # Dictionary of links found ).execute() frame.setVisible( 1 )
def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout( self.gbPanel0 ) self.Label_1 = JLabel("MD5 Hash Value To Verify") self.Label_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 1 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) self.panel0.add( self.Label_1 ) self.MD5HashValue_TF = JTextField(20, focusLost=self.keyPressedMD5) self.MD5HashValue_TF.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.MD5HashValue_TF, self.gbcPanel0 ) self.panel0.add( self.MD5HashValue_TF ) self.Blank_1 = JLabel( " ") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_1, self.gbcPanel0 ) self.panel0.add( self.Blank_1 ) self.Label_2 = JLabel("SHA1 Hash Value To Verify") self.Label_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 7 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_2, self.gbcPanel0 ) self.panel0.add( self.Label_2 ) self.SHA1HashValue_TF = JTextField(20, focusLost=self.keyPressedSHA1) self.SHA1HashValue_TF.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.SHA1HashValue_TF, self.gbcPanel0 ) self.panel0.add( self.SHA1HashValue_TF ) self.Blank_2 = JLabel( " ") self.Blank_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_1, self.gbcPanel0 ) self.panel0.add( self.Blank_1 ) self.Label_3 = JLabel("FTK Log File") self.Label_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_3, self.gbcPanel0 ) self.panel0.add( self.Label_3 ) self.FTKLogFile_TF = JTextField(20) self.FTKLogFile_TF.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.FTKLogFile_TF, self.gbcPanel0 ) self.panel0.add( self.FTKLogFile_TF ) self.FTKLogFile_BTN = JButton( "Find File", actionPerformed=self.FindFTKTxtFile) self.FTKLogFile_BTN.setEnabled(True) self.rbgPanel0.add( self.FTKLogFile_BTN ) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.FTKLogFile_BTN, self.gbcPanel0 ) self.panel0.add( self.FTKLogFile_BTN ) self.Label_4 = JLabel( "Message:") self.Label_4.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 29 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_4, self.gbcPanel0 ) self.panel0.add( self.Label_4 ) self.Error_Message = JLabel( "") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 31 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) self.panel0.add( self.Error_Message ) self.add(self.panel0)
FORCE_POST = False MAX_URI = 8178 HIT_DETECTION = 'LEN' # change to 'TAG' for the tagmap instead of size - useful for pages returning content with different size (dynamic) - could be automated to detect this automatically; would be even better to port the response comparison mechanism from the Backslash-powered Scanner, much more reliable DEBUG = True VERSION = "0.1" params_file = 'params.to.brute.txt' base_resp_string = '' base_resp_print = '' callbacks = None helpers = None last_base_resp = None first_run = True brute_params = [] params_number = 0 panel = JPanel() def safe_bytes_to_string(bytes): if bytes is None: bytes = '' return helpers.bytesToString(bytes) class BurpExtender(IBurpExtender): def registerExtenderCallbacks(self, this_callbacks): global callbacks, helpers, params_number, brute_params, params_file, VERSION, panel callbacks = this_callbacks helpers = callbacks.getHelpers() callbacks.setExtensionName("parambrute")
class BurpExtender(IBurpExtender, IIntruderPayloadGeneratorFactory, ITab): name = "Http.sys fuzzing" args = "" binary = "" _jTabbedPane = JTabbedPane() _jPanel = JPanel() _jAboutPanel = JPanel() _jPanelConstraints = GridBagConstraints() _jLabelParameters = None _jTextFieldParameters = None _jLabelTechniques = None _jTextFieldTechniques = None _jLabelFuzzFactor = None _jTextFieldFuzzFactor = None _jLabelAdditionalCmdLine = None _jTextFieldAdditionalCmdLine = None _jButtonSetCommandLine = None _jLabelAbout = None aboutText = """ <html><body><h1>made by hushpuppy</h1></body></html> """ def registerExtenderCallbacks(self, callbacks): self._callbacks = callbacks self._helpers = callbacks.getHelpers() callbacks.setExtensionName(self.name) callbacks.registerIntruderPayloadGeneratorFactory(self) callbacks.addSuiteTab(self) self.initPanelConfig() self._jTabbedPane.addTab("Configuration", self._jPanel) self._jTabbedPane.addTab("About", self._jAboutPanel) return def getUiComponent(self): return self._jTabbedPane def getTabCaption(self): return "Http.sys fuzzing" def initPanelConfig(self): self._jPanel.setBounds(0, 0, 1000, 1000) self._jPanel.setLayout(GridBagLayout()) self._jAboutPanel.setBounds(0, 0, 1000, 1000) self._jAboutPanel.setLayout(GridBagLayout()) self._jLabelAdditionalCmdLine = JLabel("set url:") self._jPanelConstraints.fill = GridBagConstraints.HORIZONTAL self._jPanelConstraints.gridx = 0 self._jPanelConstraints.gridy = 0 self._jPanel.add(self._jLabelAdditionalCmdLine, self._jPanelConstraints) self._jTextFieldParameters = JTextField("",20) self._jPanelConstraints.fill = GridBagConstraints.HORIZONTAL self._jPanelConstraints.gridx = 1 self._jPanelConstraints.gridy = 0 self._jPanel.add(self._jTextFieldParameters, self._jPanelConstraints) self._jButtonSetCommandLine = JButton('go to test', actionPerformed=self.createNewInstance) self._jPanelConstraints.fill = GridBagConstraints.HORIZONTAL self._jPanelConstraints.gridx = 0 self._jPanelConstraints.gridy = 5 self._jPanelConstraints.gridwidth = 2 self._jPanel.add(self._jButtonSetCommandLine, self._jPanelConstraints) self._jLabelAbout = JLabel("<html><body>%s</body></html>" % self.aboutText) self._jPanelConstraints.fill = GridBagConstraints.HORIZONTAL self._jPanelConstraints.gridx = 0 self._jPanelConstraints.gridy = 0 self._jAboutPanel.add(self._jLabelAbout, self._jPanelConstraints) def getGeneratorName(self): return "Http.sys fuzz" def createNewInstance(self,event=None): self.args = self._jTextFieldParameters.getText() print self.args if len(self.args) == 0: JOptionPane.showMessageDialog(None, "please input url") else: headers = {"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Range":"bytes=0-18446744073709551615", "Host":"stuff"} try: t = urllib2.Request(self.args, headers=headers,timeout=5) r = urllib2.urlopen(t) JOptionPane.showMessageDialog(None, "working") if r.status_code == 416: JOptionPane.showMessageDialog(None, "IIS Http.sys RCE") else: JOptionPane.showMessageDialog(None, "don't have IIS Http.sys RCE") # JOptionPane.showMessageDialog(None, "set over") # return r except KeyboardInterrupt: sys.exit(0) except: JOptionPane.showMessageDialog(None, "time out or something wrong") return None
def registerExtenderCallbacks(self, callbacks): # keep a reference to our callbacks object self._callbacks = callbacks # obtain an extension helpers object self._helpers = callbacks.getHelpers() # set our extension name callbacks.setExtensionName("Test Auth | Cookie Repalce ") # create the log and a lock on which to synchronize when adding log entries self._log = ArrayList() self._lock = Lock() # main split pane self._splitpane = JSplitPane(JSplitPane.VERTICAL_SPLIT) # user jpanel add compenents self._panel=JPanel() self._panel.setLayout(BorderLayout()) subpanel=JPanel() button =JButton("OK") subpanel.add(button) self._panel.add(subpanel,BorderLayout.NORTH) # table of log entries logTable = Table(self) scrollPane = JScrollPane(logTable) self._splitpane.setLeftComponent(scrollPane) self._panel.add(self._splitpane,BorderLayout.CENTER) # tabs with request/response viewers tabs = JTabbedPane() self._requestViewer = callbacks.createMessageEditor(self, False) self._responseViewer = callbacks.createMessageEditor(self, False) tabs.addTab("Request", self._requestViewer.getComponent()) tabs.addTab("Response", self._responseViewer.getComponent()) self._splitpane.setRightComponent(tabs) # customize our UI components callbacks.customizeUiComponent(self._splitpane) # callbacks.customizeUiComponent(logTable) # callbacks.customizeUiComponent(scrollPane) # callbacks.customizeUiComponent(tabs) callbacks.customizeUiComponent(self._panel) callbacks.customizeUiComponent(subpanel) # callbacks.customizeUiComponent(button) # add the custom tab to Burp's UI callbacks.addSuiteTab(self) # register ourselves as an HTTP listener callbacks.registerHttpListener(self) return
timeReporter += "\n" timeReporter += "Runtime = " timeReporter += str(hackTimer1 - hackTimer0) timeReporter += " s" JOptionPane.showMessageDialog(mainForm, timeReporter, "Pemberitahuan", JOptionPane.ERROR_MESSAGE) except: JOptionPane.showMessageDialog(mainForm, "Gagal memecahkan kunci", "Pemberitahuan", JOptionPane.ERROR_MESSAGE) mainForm = JFrame("Hacker Form", size=(987, 610)) myPanel = JPanel() myPanel.setOpaque(True) myPanel.setBackground(Color.WHITE) myPanel.setLayout(None) # All Events Belong Here # All Buttons Belong Here hackButton = JButton("Pecahkan Kunci", actionPerformed=react) hackButton.setSize(243, 55) hackButton.setLocation(62, 307) hackButton.setFont(regFont) laporan = JLabel("Laporan Pemecahan Kunci") laporan.setSize(200, 21) laporan.setLocation(26, 376)
def makeFlow(*elts): p = JPanel() p.setLayout(FlowLayout()) for b in elts: p.add(b) return p
frame = JFrame('Lektion erstellen', defaultCloseOperation = JFrame.EXIT_ON_CLOSE, size = (500, 500), ) def change_text(event): text = feld.getText() name = feld2.getText() + ".csv" with open(name,"w") as f: f.write(text) print(name + " gespeichert") return(text) button = JButton('Lektion speichern!', actionPerformed=change_text,size=(10,20)) button.setBounds(20,40,20,40); pnl = JPanel() pnl.setLayout(BoxLayout(pnl, BoxLayout.Y_AXIS)) feld = JTextArea() feld.editable = True feld.setText("Deutsch,Englisch\n") feld2 = JTextField() feld2.setText("Ersetzen durch Namen der Lektion") pnl.add(feld2) pnl.add(feld) pnl.add(button) frame.add(pnl) frame.setVisible(True) class Main(Client): def __init__(self):
def makeGrid(i,j,*elts): p = JPanel() p.setLayout(GridLayout(i,j)) for b in elts: p.add(b) return p
def __init__(self, *args, **kwargs): # do not create any class members before calling JFrame.__init__ ! s, size, title, savemode = None, None, None, False self.OKstatus = True if 'settings_config' in kwargs: s = kwargs.pop('settings_config') else: s = None if 'size' in kwargs: size = kwargs.pop('size') else: size = (300, 300) if 'widget' in kwargs: widget = kwargs.pop('widget') else: widget = None if 'savemode' in kwargs: savemode = kwargs.pop('savemode') defaultdir = None if 'defaultdir' in kwargs: defaultdir = kwargs.pop('defaultdir') if len(args) > 0: title = args[0] else: title = 'Save Settings' JFrame.__init__(self, title, size=size, **kwargs) self.widget = widget if self.widget == None: print "Need to pass keyword argument widget=widget when creating SettingsTableFrame" self.s = s self.savemode = savemode self.defaultdir = defaultdir # create FileChooser, make its window bigger and choose smaller font if self.defaultdir != None: self.fc = JFileChooser(self.defaultdir) else: self.fc = JFileChooser() self.fc.setPreferredSize(Dimension(800, 600)) smallfont = Font("Lucida Sans", Font.PLAIN, 12) SetFontRecursively(self.fc.getComponents(), smallfont) filefilter = FileNameExtensionFilter("Settings Files", (DEFAULT_EXTENSION, )) self.fc.setFileFilter(filefilter) # fill the table, in save mode only with the current values, in load mode with current and setting values self.prepare_tabledata() # if not savemode, we first pop up a filechooser to select a loadable setting if self.savemode == False: self.OKstatus = self.load_setting() if not self.OKstatus: return # listener for data edited by user, good for providing PV write access within the table to the user self.dataListener = MyTableModelListener(savemode=self.savemode) self.dataModel.addTableModelListener(self.dataListener) self.table = JTable(self.dataModel) # create Buttons self.bu_do_label = "Save" if self.savemode == True else "Load" self.bu_do_handler = self.bu_save_handler if self.savemode == True else self.bu_load_handler self.bu_do = JButton(self.bu_do_label, actionPerformed=self.bu_do_handler) self.bu_cancel = JButton("Cancel", actionPerformed=self.bu_cancel_handler) # BEGIN visual adaptations of JTable self.table.setRowHeight(24) self.table.getColumnModel().getColumn(0).setMinWidth(200) if self.savemode: self.table.getColumnModel().getColumn(3).setMaxWidth(60) else: self.table.getColumnModel().getColumn(4).setMaxWidth(60) smallfontr = MyTableCellRenderer(font=FONT_FAMILY, style=Font.PLAIN, fontsize=10) smallfontr.setHorizontalAlignment(JLabel.CENTER) bigfontplainr = MyTableCellRenderer(font=FONT_FAMILY, style=Font.PLAIN, fontsize=18) bigfontplainr.setHorizontalAlignment(JLabel.CENTER) bigfontr = MyTableCellRenderer(font=FONT_FAMILY, style=Font.BOLD, fontsize=18) bigfontr.setHorizontalAlignment(JLabel.CENTER) self.table.getColumnModel().getColumn(0).setCellRenderer(smallfontr) self.table.getColumnModel().getColumn(1).setCellRenderer(bigfontplainr) self.table.getColumnModel().getColumn(2).setCellRenderer(bigfontr) if not self.savemode: self.table.getColumnModel().getColumn(3).setCellRenderer(bigfontr) # END visual adaptations of JTable ## BEGIN layout of window (JFrame) self.getContentPane().setLayout(BorderLayout()) self.add(JScrollPane(self.table)) self.bottompanel = JPanel() self.bottompanel.setLayout( BoxLayout(self.bottompanel, BoxLayout.LINE_AXIS)) self.bottompanel.add(Box.createHorizontalGlue()) self.bottompanel.add(self.bu_do) self.bottompanel.add(Box.createRigidArea(Dimension(20, 0))) self.bottompanel.add(self.bu_cancel) self.bottompanel.add(Box.createHorizontalGlue()) self.add(self.bottompanel, BorderLayout.SOUTH)
def makeBorder(el): p = JPanel() p.setLayout(BorderLayout()) p.add("Center",el) return p
uebersichtLabel2 = JLabel() uebersichtLabel2.setText( "<html><font size=+1 color=#191970>vorhandene Lektionen:</font></html>") uebersichtLabel2.setBounds(450, 200, 250, 50) uebersicht2 = JTextArea() uebersicht2.editable = False uebersicht_scroll2 = JScrollPane(uebersicht2) uebersicht_scroll2.viewport.view = uebersicht2 uebersicht_scroll2.setBounds(450, 250, 250, 410) feld_feedback = JTextArea() feld_feedback.editable = False feld_feedback.setBounds(50, 50, 300, 600) button_close = JButton('close window', actionPerformed=close2) button_close.setBounds(50, 650, 300, 30) hintergrund2 = ImageIcon("Hintergrund.jpg") pnl2 = JPanel() hintergrundlabel2 = JLabel(hintergrund2) frame_feedback.setContentPane(hintergrundlabel2) frame_feedback.add(button_close) frame_feedback.add(uebersicht_scroll2) frame_feedback.add(uebersichtLabel2) frame_feedback.add(feld_feedback) frame_feedback.setVisible(False) class Main(Client): def __init__(self): pass def stateChanged(self, cs): print "new state: " + str(cs)
def __init__(self, actions=[], restore=None, proxy=None, http_mutator=None, texteditor_factory=None, requests=None, stub_responses=None): self._requests = requests if requests is not None else {} self._stub_responses = stub_responses if stub_responses is not None else {} self._actions = actions self._load_headers = [] self._run_config = [['Proxy', proxy], ['Authorization Key', None], ['Load Placeholders', True], ['Generate HTML DOC', True], ['Generate Schema DOC', False], ['Generate Stub Queries', True], ['Accept Invalid SSL Certificate', True], ['Generate Cycles Report', False], ['Cycles Report Timeout', 60], ['Generate TSV', False]] self._init_config = json.loads(json.dumps(self._run_config)) self._default_config = {} for k, v in self._run_config: self._default_config[k] = v self._old_config_hash = None self._actions.insert(0, BrowserAction()) self._actions.insert( 0, ExecutorAction("Configure", lambda _: self._setup())) self._actions.insert(0, ExecutorAction("Load", self._loadurl)) self._http_mutator = http_mutator self.this = JPanel() self.this.setLayout(BorderLayout()) self._omnibar = Omnibar(hint=DEFAULT_LOAD_URL, label="Load", action=self._loadurl) self.this.add(BorderLayout.PAGE_START, self._omnibar.this) self._fileview = FileView( dir=os.getcwd(), filetree_label="Queries, Mutations and Subscriptions", texteditor_factory=texteditor_factory) self.this.add(BorderLayout.CENTER, self._fileview.this) self._fileview.addTreeListener(self._tree_listener) self._fileview.addPayloadListener(self._payload_listener) self._popup = JPopupMenu() self.this.setComponentPopupMenu(self._popup) inherits_popup_menu(self.this) for action in self._actions: self._popup.add(action.menuitem) self._state = {'runs': []} try: if restore: cfg = json.loads(restore) if 'runs' in cfg: for target, key, proxy, headers, load_placeholer, generate_html, generate_schema, generate_queries, generate_cycles, cycles_timeout, generate_tsv, accept_invalid_certificate, flag in cfg[ 'runs']: self._run(target=target, key=key, proxy=proxy, headers=headers, load_placeholer=load_placeholer, generate_html=generate_html, generate_schema=generate_schema, generate_queries=generate_queries, generate_cycles=generate_cycles, cycles_timeout=cycles_timeout, generate_tsv=generate_tsv, accept_invalid_certificate= accept_invalid_certificate, flag=flag) self._run_config = cfg['config'] except Exception as ex: print( "Cannot Load old configuration: starting with a clean state: %s" % ex) sys.stdout.flush() self._state['config'] = self._run_config
def registerExtenderCallbacks(self, callbacks): # keep a reference to our callbacks object self._callbacks = callbacks # obtain an extension helpers object self._helpers = callbacks.getHelpers() # set our extension name callbacks.setExtensionName("Response Clusterer") # create the log and a lock on which to synchronize when adding log entries self._log = ArrayList() self._lock = Lock() # main split pane self._main_jtabedpane = JTabbedPane() # The split pane with the log and request/respponse details self._splitpane = JSplitPane(JSplitPane.VERTICAL_SPLIT) # table of log entries logTable = Table(self) scrollPane = JScrollPane(logTable) self._splitpane.setLeftComponent(scrollPane) # List of log entries self._log_entries = [] # tabs with request/response viewers tabs = JTabbedPane() self._requestViewer = callbacks.createMessageEditor(self, False) self._responseViewer = callbacks.createMessageEditor(self, False) tabs.addTab("Request", self._requestViewer.getComponent()) tabs.addTab("Response", self._responseViewer.getComponent()) self._splitpane.setRightComponent(tabs) #Setup the options self._optionsJPanel = JPanel() gridBagLayout = GridBagLayout() gbc = GridBagConstraints() self._optionsJPanel.setLayout(gridBagLayout) self.max_clusters = 500 self.JLabel_max_clusters = JLabel("Maximum amount of clusters: ") gbc.gridy = 0 gbc.gridx = 0 self._optionsJPanel.add(self.JLabel_max_clusters, gbc) self.JTextField_max_clusters = JTextField(str(self.max_clusters), 5) self.JTextField_max_clusters.getDocument().addDocumentListener(self) gbc.gridx = 1 self._optionsJPanel.add(self.JTextField_max_clusters, gbc) callbacks.customizeUiComponent(self.JLabel_max_clusters) callbacks.customizeUiComponent(self.JTextField_max_clusters) self.similarity = 0.95 self.JLabel_similarity = JLabel("Similarity (between 0 and 1)") gbc.gridy = 1 gbc.gridx = 0 self._optionsJPanel.add(self.JLabel_similarity, gbc) self.JTextField_similarity = JTextField(str(self.similarity), 5) self.JTextField_similarity.getDocument().addDocumentListener(self) gbc.gridx = 1 self._optionsJPanel.add(self.JTextField_similarity, gbc) callbacks.customizeUiComponent(self.JLabel_similarity) callbacks.customizeUiComponent(self.JTextField_similarity) self.use_quick_similar = False self.JLabel_use_quick_similar = JLabel( "Use set intersection of space splitted tokens for similarity (default: optimized difflib.SequenceMatcher.quick_ratio)" ) gbc.gridy = 2 gbc.gridx = 0 self._optionsJPanel.add(self.JLabel_use_quick_similar, gbc) self.JCheckBox_use_quick_similar = JCheckBox("") self.JCheckBox_use_quick_similar.addActionListener(self) gbc.gridx = 1 self._optionsJPanel.add(self.JCheckBox_use_quick_similar, gbc) callbacks.customizeUiComponent(self.JCheckBox_use_quick_similar) self.response_max_size = 10 * 1024 #10kb self.JLabel_response_max_size = JLabel("Response max size (bytes)") gbc.gridy = 3 gbc.gridx = 0 self._optionsJPanel.add(self.JLabel_response_max_size, gbc) self.JTextField_response_max_size = JTextField( str(self.response_max_size), 5) self.JTextField_response_max_size.getDocument().addDocumentListener( self) gbc.gridx = 1 self._optionsJPanel.add(self.JTextField_response_max_size, gbc) callbacks.customizeUiComponent(self.JLabel_response_max_size) callbacks.customizeUiComponent(self.JTextField_response_max_size) self.uninteresting_mime_types = ('JPEG', 'CSS', 'GIF', 'script', 'GIF', 'PNG', 'image') self.uninteresting_status_codes = () self.uninteresting_url_file_extensions = ('js', 'css', 'zip', 'war', 'jar', 'doc', 'docx', 'xls', 'xlsx', 'pdf', 'exe', 'dll', 'png', 'jpeg', 'jpg', 'bmp', 'tif', 'tiff', 'gif', 'webp', 'm3u', 'mp4', 'm4a', 'ogg', 'aac', 'flac', 'mp3', 'wav', 'avi', 'mov', 'mpeg', 'wmv', 'swf', 'woff', 'woff2') about = "<html>" about += "Author: floyd, @floyd_ch, http://www.floyd.ch<br>" about += "modzero AG, http://www.modzero.ch<br>" about += "<br>" about += "<h3>Getting an overview of the tested website</h3>" about += "<p style=\"width:500px\">" about += "This plugin clusters all response bodies by similarity and shows a summary, one request/response per cluster. " about += 'Adjust similarity in the options if you get too few or too many entries in the "One member of each cluster" ' about += "tab. The plugin will allow a tester to get an overview of the tested website's responses from all tools (scanner, proxy, etc.). " about += "As similarity comparison " about += "can use a lot of ressources, only small, in-scope responses that have interesting response codes, " about += "file extensions and mime types are processed. " about += "</p>" about += "</html>" self.JLabel_about = JLabel(about) self.JLabel_about.setLayout(GridBagLayout()) self._aboutJPanel = JScrollPane(self.JLabel_about) # customize our UI components callbacks.customizeUiComponent(self._splitpane) callbacks.customizeUiComponent(logTable) callbacks.customizeUiComponent(scrollPane) callbacks.customizeUiComponent(tabs) # add the splitpane and options to the main jtabedpane self._main_jtabedpane.addTab("One member of each cluster", None, self._splitpane, None) self._main_jtabedpane.addTab("Options", None, self._optionsJPanel, None) self._main_jtabedpane.addTab("About & README", None, self._aboutJPanel, None) # clusters will grow up to self.max_clusters response bodies... self._clusters = set() self.Similarity = Similarity() # Now load the already stored with self._lock: log_entries_from_storage = self.load_project_setting("log_entries") if log_entries_from_storage: for toolFlag, req, resp, url in log_entries_from_storage: try: self.add_new_log_entry(toolFlag, req, resp, url) except Exception as e: print "Exception when deserializing a stored log entry", toolFlag, url print e # Important: Do this at the very end (otherwise we could run into troubles locking up entire threads) # add the custom tab to Burp's UI callbacks.addSuiteTab(self) # register ourselves as an HTTP listener callbacks.registerHttpListener(self)
def __init__(self, kconfig_file="Kconfig", config_file=".config", systemLogger=None): """[summary] Parameters ---------- kconfig_file : string (default: "Kconfig") The Kconfig configuration file config_file : string (default: ".config") The save file which will be used for loading and saving the settings systemLogger (default: None) A system logger object. If None then print statements are used for logging. """ global log if systemLogger: log = systemLogger # Load Kconfig configuration files self.kconfig = Kconfig(kconfig_file) setKConfig(self.kconfig) if os.path.isfile(config_file): log.info(self.kconfig.load_config(config_file)) elif os.path.isfile(".config"): log.info(self.kconfig.load_config(".config")) self.tree = KConfigTree(self.kconfig) self.tree.addTreeSelectionListener(self.treeSelectionChanged) jTreeSP = JScrollPane(self.tree) self.jta = JTextArea() self.jta.setEditable(False) jTextSP = JScrollPane(self.jta) toolPanel = JPanel() toolPanel.setLayout(BoxLayout(toolPanel, BoxLayout.X_AXIS)) toolPanel.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0)) toolPanel.add(JLabel("Search: ")) jSearchPanel = JPanel() jSearchPanel.setLayout(BoxLayout(jSearchPanel, BoxLayout.X_AXIS)) self.jSearchField = JTextField() jSearchPanel.setBackground(self.jSearchField.getBackground()) jSearchPanel.setBorder(self.jSearchField.getBorder()) self.jSearchField.setBorder(None) self.jSearchField.getDocument().addDocumentListener( SearchListener(self.tree)) jSearchPanel.add(self.jSearchField) clearSearchButton = JButton(u'\u00d7', actionPerformed=self.clearSearch) d = clearSearchButton.getPreferredSize() clearSearchButton.setPreferredSize(Dimension(d.height, d.height)) clearSearchButton.setBackground(self.jSearchField.getBackground()) clearSearchButton.setBorder(None) clearSearchButton.setOpaque(False) clearSearchButton.setContentAreaFilled(False) clearSearchButton.setFocusPainted(False) jSearchPanel.add(clearSearchButton) toolPanel.add(jSearchPanel) self.showAllCheckBox = JCheckBox("Show all", actionPerformed=self.OnShowAllCheck) toolPanel.add(self.showAllCheckBox) splitPane = JSplitPane(JSplitPane.VERTICAL_SPLIT, jTreeSP, jTextSP) splitPane.setOneTouchExpandable(True) splitPane.setDividerLocation(300) treePanel = JPanel(BorderLayout()) treePanel.add(toolPanel, BorderLayout.NORTH) treePanel.add(splitPane, BorderLayout.CENTER) loadSavePanel = JPanel() loadSavePanel.setLayout(BoxLayout(loadSavePanel, BoxLayout.X_AXIS)) loadSavePanel.add( JButton("Load", actionPerformed=self.loadConfigDialog)) loadSavePanel.add( JButton("Save as", actionPerformed=self.writeConfigDialog)) self.rootPanel = JPanel() self.rootPanel.setLayout(BorderLayout()) self.rootPanel.add(loadSavePanel, BorderLayout.PAGE_START) self.rootPanel.add(treePanel, BorderLayout.CENTER)
def createStudentFeeForm(stFeeObj): global tfStudentId global tfStudentName global tfTotalAmount global tfPaidAmount global tfRemainingAmount global frame frame = JFrame("Student Fee Form ") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(500,500) frame.setLocation(200,200) frame.setLayout(None) frame.setVisible(True) panel = JPanel() panel.setSize(500,500) panel.setLocation(0,0) panel.setLayout(None) panel.setVisible(True) panel.setBackground(Color.LIGHT_GRAY) heading = JLabel("STUDENT FEE") heading.setBounds(200,30,150,40) lbStudentId = JLabel(" Student id") lbStudentName = JLabel(" student name") lbTotalAmount = JLabel("Total Amount ") lbPaidAmount = JLabel("Paid Amount") lbRemainingAmount = JLabel("Remaining amount") studentId =getattr(stFeeObj,'studentId') studentName =getattr(stFeeObj,'studentName') totalAmount =getattr(stFeeObj,'totalAmount') paidAmount =getattr(stFeeObj,'paidAmount') remainingAmount =getattr(stFeeObj,'remainingAmount') tfStudentId = JTextField(str(studentId)) tfStudentName = JTextField(str(studentName)) tfTotalAmount = JTextField(str(totalAmount)) tfPaidAmount = JTextField(str(paidAmount)) tfRemainingAmount = JTextField(str(remainingAmount)) tfStudentId.setEditable(False) tfStudentName.setEditable(False) tfTotalAmount.setEditable(False) tfRemainingAmount.setEditable(False) lbStudentId.setBounds(70,100,130,30) lbStudentName.setBounds(70,150,130,30) lbTotalAmount.setBounds(70,200,130,30) lbPaidAmount.setBounds(70,250,130,30) lbRemainingAmount.setBounds(70,300,130,30) tfStudentId.setBounds(220,100,130,30) tfStudentName.setBounds(220,150,130,30) tfTotalAmount.setBounds(220,200,130,30) tfPaidAmount.setBounds(220,250,130,30) tfRemainingAmount.setBounds(220,300,130,30) btnPay = JButton("Paid",actionPerformed=clickPay) btnPay.setBounds(350,410,100,40) btnCancel = JButton("Cancel",actionPerformed=clickbtnCancelForm) btnCancel.setBounds(50,410,100,40) panel.add(heading) panel.add(lbStudentId) panel.add(lbStudentName) panel.add(lbTotalAmount) panel.add(lbPaidAmount) panel.add(lbRemainingAmount) panel.add(tfStudentId) panel.add(tfStudentName) panel.add(tfTotalAmount) panel.add(tfPaidAmount) panel.add(tfRemainingAmount) panel.add(btnPay) panel.add(btnCancel) frame.add(panel)
if (clip.isRunning()) clip.stop(); clip.setFramePosition(0); clip.start(); } static void init() { values(); } } public LanderDisplay(RangeView arena) { setTitle("Lander Range"); rangeView = arena; panelGroup1 = new JPanel(); panelGroup1.setLayout(new BoxLayout(panelGroup1, BoxLayout.X_AXIS)); panelGroup1.add(rangeView); buttonPanel = new ButtonPanel(this); panelGroup0 = new JPanel(); panelGroup0.setLayout(new BoxLayout(panelGroup0, BoxLayout.Y_AXIS)); panelGroup0.add(panelGroup1); panelGroup0.add(buttonPanel); add(panelGroup0); setScale(32); setLanderPos (0.0, 1.8);
def _constructAttackPanel(self, insets, messageEditorComponent): attackPanel = JPanel(GridBagLayout()) targetHeadingLabel = JLabel("<html><b>Target</b></html>") targetHeadingLabelConstraints = GridBagConstraints() targetHeadingLabelConstraints.gridx = 0 targetHeadingLabelConstraints.gridy = 0 targetHeadingLabelConstraints.gridwidth = 4 targetHeadingLabelConstraints.anchor = GridBagConstraints.LINE_START targetHeadingLabelConstraints.insets = insets attackPanel.add(targetHeadingLabel, targetHeadingLabelConstraints) startAttackButton = JButton("<html><b>Start Attack</b></html>", actionPerformed=self._startAttack) startAttackButtonConstraints = GridBagConstraints() startAttackButtonConstraints.gridx = 4 startAttackButtonConstraints.gridy = 0 startAttackButtonConstraints.insets = insets attackPanel.add(startAttackButton, startAttackButtonConstraints) hostLabel = JLabel("Host:") hostLabelConstraints = GridBagConstraints() hostLabelConstraints.gridx = 0 hostLabelConstraints.gridy = 1 hostLabelConstraints.anchor = GridBagConstraints.LINE_START hostLabelConstraints.insets = insets attackPanel.add(hostLabel, hostLabelConstraints) self._hostTextField = JTextField(25) self._hostTextField.setMinimumSize( self._hostTextField.getPreferredSize()) hostTextFieldConstraints = GridBagConstraints() hostTextFieldConstraints.gridx = 1 hostTextFieldConstraints.gridy = 1 hostTextFieldConstraints.weightx = 1 hostTextFieldConstraints.gridwidth = 2 hostTextFieldConstraints.anchor = GridBagConstraints.LINE_START hostTextFieldConstraints.insets = insets attackPanel.add(self._hostTextField, hostTextFieldConstraints) portLabel = JLabel("Port:") portLabelConstraints = GridBagConstraints() portLabelConstraints.gridx = 0 portLabelConstraints.gridy = 2 portLabelConstraints.anchor = GridBagConstraints.LINE_START portLabelConstraints.insets = insets attackPanel.add(portLabel, portLabelConstraints) self._portTextField = JTextField(5) self._portTextField.setMinimumSize( self._portTextField.getPreferredSize()) portTextFieldConstraints = GridBagConstraints() portTextFieldConstraints.gridx = 1 portTextFieldConstraints.gridy = 2 portTextFieldConstraints.gridwidth = 2 portTextFieldConstraints.anchor = GridBagConstraints.LINE_START portTextFieldConstraints.insets = insets attackPanel.add(self._portTextField, portTextFieldConstraints) self._protocolCheckBox = JCheckBox("Use HTTPS") protocolCheckBoxConstraints = GridBagConstraints() protocolCheckBoxConstraints.gridx = 0 protocolCheckBoxConstraints.gridy = 3 protocolCheckBoxConstraints.gridwidth = 3 protocolCheckBoxConstraints.anchor = GridBagConstraints.LINE_START protocolCheckBoxConstraints.insets = insets attackPanel.add(self._protocolCheckBox, protocolCheckBoxConstraints) requestHeadingLabel = JLabel("<html><b>Request</b></html>") requestHeadingLabelConstraints = GridBagConstraints() requestHeadingLabelConstraints.gridx = 0 requestHeadingLabelConstraints.gridy = 4 requestHeadingLabelConstraints.gridwidth = 4 requestHeadingLabelConstraints.anchor = GridBagConstraints.LINE_START requestHeadingLabelConstraints.insets = insets attackPanel.add(requestHeadingLabel, requestHeadingLabelConstraints) messageEditorComponentConstraints = GridBagConstraints() messageEditorComponentConstraints.gridx = 0 messageEditorComponentConstraints.gridy = 5 messageEditorComponentConstraints.weightx = 1 messageEditorComponentConstraints.weighty = .75 messageEditorComponentConstraints.gridwidth = 4 messageEditorComponentConstraints.gridheight = 2 messageEditorComponentConstraints.fill = GridBagConstraints.BOTH messageEditorComponentConstraints.insets = insets attackPanel.add( messageEditorComponent, messageEditorComponentConstraints) addPayloadButton = JButton( "Add \xa7", actionPerformed=self._addPayload) addPayloadButtonConstraints = GridBagConstraints() addPayloadButtonConstraints.gridx = 4 addPayloadButtonConstraints.gridy = 5 addPayloadButtonConstraints.fill = GridBagConstraints.HORIZONTAL addPayloadButtonConstraints.insets = insets attackPanel.add(addPayloadButton, addPayloadButtonConstraints) clearPayloadButton = JButton( "Clear \xa7", actionPerformed=self._clearPayloads) clearPayloadButtonConstraints = GridBagConstraints() clearPayloadButtonConstraints.gridx = 4 clearPayloadButtonConstraints.gridy = 6 clearPayloadButtonConstraints.anchor = GridBagConstraints.PAGE_START clearPayloadButtonConstraints.fill = GridBagConstraints.HORIZONTAL clearPayloadButtonConstraints.insets = insets attackPanel.add(clearPayloadButton, clearPayloadButtonConstraints) payloadHeadingLabel = JLabel("<html><b>Payloads<b></html>") payloadHeadingLabelConstraints = GridBagConstraints() payloadHeadingLabelConstraints.gridx = 0 payloadHeadingLabelConstraints.gridy = 7 payloadHeadingLabelConstraints.gridwidth = 4 payloadHeadingLabelConstraints.anchor = GridBagConstraints.LINE_START payloadHeadingLabelConstraints.insets = insets attackPanel.add(payloadHeadingLabel, payloadHeadingLabelConstraints) self._payloadTextArea = JTextArea() payloadScrollPane = JScrollPane(self._payloadTextArea) payloadScrollPaneConstraints = GridBagConstraints() payloadScrollPaneConstraints.gridx = 0 payloadScrollPaneConstraints.gridy = 8 payloadScrollPaneConstraints.weighty = .25 payloadScrollPaneConstraints.gridwidth = 3 payloadScrollPaneConstraints.fill = GridBagConstraints.BOTH payloadScrollPaneConstraints.insets = insets attackPanel.add(payloadScrollPane, payloadScrollPaneConstraints) requestsNumLabel = JLabel("Number of requests for each payload:") requestsNumLabelConstraints = GridBagConstraints() requestsNumLabelConstraints.gridx = 0 requestsNumLabelConstraints.gridy = 9 requestsNumLabelConstraints.gridwidth = 2 requestsNumLabelConstraints.anchor = GridBagConstraints.LINE_START requestsNumLabelConstraints.insets = insets attackPanel.add(requestsNumLabel, requestsNumLabelConstraints) self._requestsNumTextField = JTextField("100", 4) self._requestsNumTextField.setMinimumSize( self._requestsNumTextField.getPreferredSize()) requestsNumTextFieldConstraints = GridBagConstraints() requestsNumTextFieldConstraints.gridx = 2 requestsNumTextFieldConstraints.gridy = 9 requestsNumTextFieldConstraints.anchor = GridBagConstraints.LINE_START requestsNumTextFieldConstraints.insets = insets attackPanel.add( self._requestsNumTextField, requestsNumTextFieldConstraints) return attackPanel
def _create_texteditor(self, name=None, label=None): _textarea = None if name and name in self._widgets: return self._widgets[name] if not name: name = "TextArea#%s" % self._idx self._idx += 1 this = JPanel() # Add a label if label: this.setLayout(BorderLayout()) this.add(BorderLayout.PAGE_START, JLabel(label)) if self._texteditor_factory: _texteditor = self._texteditor_factory() _component = _texteditor.getComponent() this.add(BorderLayout.CENTER, _component) _textarea = self._get_textarea(_component) if not _textarea: _textarea = JTextArea() _textarea.setColumns(20) _textarea.setRows(5) _textarea.setLineWrap(True) _textarea.setWrapStyleWord(True) _textarea.setEditable(True) _textarea.setName(name) _textarea.setSelectionColor(Color(255, 153, 51)) _textarea.requestFocus() # Add textarea to a scrollable JPane _scrollpane = JScrollPane() _scrollpane.setViewportView(_textarea) this.add(BorderLayout.CENTER, _scrollpane) _textarea.setEditable(self.editable) self._textareas[name] = _textarea self._widgets[name] = this def on_change(evt): if not self._textareas[name].hasFocus(): return try: if name == "raw": SwingUtilities.invokeLater(lambda: self._refresh_queries( self._textareas['raw'].getText())) elif name.startswith('gql_query#'): id = int(name.split("#")[1]) content = json.loads(self._textareas['raw'].getText()) if id == 0 and not isinstance(content, list): content['query'] = self._textareas[name].getText() else: content[id]['query'] = self._textareas[name].getText() SwingUtilities.invokeLater(lambda: self._textareas['raw']. setText(json.dumps(content))) elif name.startswith('gql_variables#'): id = int(name.split("#")[1]) content = json.loads(self._textareas['raw'].getText()) if id == 0 and not isinstance(content, list): content['variables'] = json.loads( self._textareas[name].getText()) else: content[id]['variables'] = json.loads( self._textareas[name].getText()) SwingUtilities.invokeLater(lambda: self._textareas['raw']. setText(json.dumps(content))) except ValueError: pass # Avoid crashing for JSON not valid incompatibilities _textarea.getDocument().addDocumentListener( _PayloadListener(changed_update=on_change)) return this
# Set up the fields for the SWING interface minField = JFormattedTextField( 0 ) minField.addActionListener( ChangedMin(minField) ) maxField = JFormattedTextField( 255 ) maxField.addActionListener( ChangedMax(maxField) ) scoreField = JTextField( "" ) scoreField.addActionListener( NextImage(scoreField) ) scoreField.addActionListener( WriteScore(scoreField) ) button = JButton("Previous image") button.addActionListener( PreviousImage(scoreField) ) # Pack all the fields into a JPanel all = JPanel() layout = GridLayout(4, 1) all.setLayout(layout) all.add( JLabel(" ") ) all.add( button ) all.add( JLabel("Min") ) all.add( minField ) all.add( JLabel("Max") ) all.add(maxField ) all.add( JLabel("Score :") ) all.add(scoreField) frame = JFrame("CCM scoring") frame.getContentPane().add(JScrollPane(all)) frame.pack() frame.addWindowListener( Closing() ) scoreField.requestFocusInWindow()
def __init__(self): frame = JFrame("S1riu5 Spy") frame.setSize(700, 690) frame.setLocationRelativeTo(None) frame.setLayout(BorderLayout()) tabPane = JTabbedPane(JTabbedPane.TOP) #第一个Tab用来做C段查询 eachIp = self.getIp(HOSTDOMAIN) iList = eachIp.split(".") theIP = iList[0] + "." + iList[1] + "." + iList[2] + ".1/24" panel1 = JPanel() label = JLabel("IP CIDR:") self.textfield1 = JTextField(theIP, 15) button = JButton("SCAN", actionPerformed=self.cNmapScan) self.textArea = JTextArea(40, 65) self.textArea.append("IP: " + eachIp) self.textArea.setLineWrap(True) #激活自动换行功能 self.textArea.setWrapStyleWord(True) # 激活断行不断字功能 panel1.add(label) panel1.add(self.textfield1) panel1.add(button) panel1.add(JScrollPane(self.textArea)) #设置自动滚动条 tabPane.addTab("C segment query ", panel1) #第二个Tab用来做子域名查询 theName = self.getDomain1(HOSTDOMAIN) self.textArea2 = JTextArea(40, 65) #self.textArea.append("IP: " + eachIp) self.textArea2.setLineWrap(True) #激活自动换行功能 self.textArea2.setWrapStyleWord(True) # 激活断行不断字功能 label2 = JLabel("Domain: ") self.textfield2 = JTextField(theName, 15) button2 = JButton("SCAN", actionPerformed=self.subDomain) self.panel2 = JPanel() self.panel2.add(label2) self.panel2.add(self.textfield2) self.panel2.add(button2) #self.panel2.add(scrollPane) self.panel2.add(JScrollPane(self.textArea2)) tabPane.addTab("subDomains", self.panel2) #第三个Tab用来做敏感文件扫描 self.tableData0 = [["1", "2"]] colNames2 = ('url', 'http code') dataModel3 = DefaultTableModel(self.tableData0, colNames2) self.table3 = JTable(dataModel3) ## label3 = JLabel("URL: ") self.textfield3 = JTextField(HOSTDOMAIN, 15) self.textArea3 = JTextArea(40, 65) #self.textArea.append("IP: " + eachIp) self.textArea3.setLineWrap(True) #激活自动换行功能 self.textArea3.setWrapStyleWord(True) # 激活断行不断字功能 a = 0 b = 0 self.label4 = JLabel(str(a) + "/" + str(b)) # self.chkbox1 = JCheckBox('ASP') self.chkbox2 = JCheckBox('ASPX') self.chkbox3 = JCheckBox('JSP') self.chkbox4 = JCheckBox('PHP') self.chkbox5 = JCheckBox('MDB') self.chkbox6 = JCheckBox('DIR') button3 = JButton("SCAN", actionPerformed=self.senFileScan) panel3 = JPanel() panel3.add(label3) panel3.add(self.textfield3) panel3.add(self.chkbox1) panel3.add(self.chkbox2) panel3.add(self.chkbox3) panel3.add(self.chkbox4) panel3.add(self.chkbox5) panel3.add(self.chkbox6) panel3.add(button3) panel3.add(self.label4) panel3.add(JScrollPane(self.textArea3)) # tabPane.addTab("Sebsitive File", panel3) # frame.add(tabPane) frame.setVisible(True)