def __init__(self, target, mode): self.version = '0.0.5' self.target = target self.mode = mode self.xtype = 'bufferoverflow' self.offset = 1 self.nops = 0 self.shellcode = '' self.lenght = 0 self.addr1 = None self.addr2 = None self.arch = 'x86' self.port = 0 if self.target: self.p1 = Popen(['gdb', "--silent", "{}".format(self.target)], stdin=PIPE, stdout=PIPE, bufsize=1) gdbout = self.p1.stdout.readline() else: self.p1 = Popen(['gdb', '--silent'], stdin=PIPE, stdout=PIPE, bufsize=1) #gdbout = self.p1.stdout.readline() completer = Completer(".gdb_history", "xploit")
def __init__(self, parent, project=None): QPlainTextEdit.__init__(self) EditorGeneric.__init__(self) BaseCentralWidget.__init__(self) self.parent = parent self.completer = Completer(self, project) self.setWordWrapMode(QTextOption.NoWrap) doc = self.document() option = QTextOption() option.setFlags(QTextOption.ShowTabsAndSpaces) doc.setDefaultTextOption(option) self.setDocument(doc) self.set_default_font() #file modification time POSIX self._mtime = None #Flag to dont bug the user when answer 'dont show the modification dialog' self.ask_if_externally_modified = True self.lineNumberArea = self.LineNumberArea(self) self.viewport().installEventFilter(self) self.highlighter = None styles.set_style(self, 'editor') self.connect(self, SIGNAL("cursorPositionChanged()"), self.highlight_current_line) self.connect(self, SIGNAL("modificationChanged(bool)"), self.modif_changed) self.highlight_current_line()
def _coll(content, arg): """ List all plugin collections. """ colls = Completer([])._get_collections() print('\n') for c in colls: print('%s\n %s' % ('-' * 40, c)) print('-' * 40, '\n') return content
def __init__(self, namespace=None): if namespace is not None: namespace = namespace() InteractiveInterpreter.__init__(self, namespace) self.output_trap = OutputTrap() self.completer = Completer(self.locals) self.input_count = 0 self.interrupted = False
def main(): print("Running the configurator") # required for travis tests if len(sys.argv) > 2 and sys.argv[-2] == 'scripts/configurator_tests/': sys.argv = [sys.argv[:-2]] args = parsers._config_arg_parser() if args.error: utils.error_level = 1 print("Starting Savu Config tool (please wait for prompt)") _reduce_logging_level() content = Content(level="all" if args.disp_all else 'user') with warnings.catch_warnings(): warnings.simplefilter("ignore") content.failed = utils.populate_plugins(error_mode=args.error, examples=args.examples) comp = Completer(commands=commands, plugin_list=pu.plugins) utils._set_readline(comp.complete) # if file flag is passed then open it here if args.file: commands['open'](content, args.file) print("\n*** Press Enter for a list of available commands. ***\n") utils.load_history_file(utils.histfile) while True: try: in_list = raw_input(">>> ").strip().split(' ', 1) except KeyboardInterrupt: print() continue command, arg = in_list if len(in_list) == 2 else in_list + [''] command = command if command else 'help' if command not in commands: print("I'm sorry, that's not a command I recognise. Press Enter " "for a list of available commands.") else: content = commands[command](content, arg) if content.is_finished(): break print("Thanks for using the application")
def main(): """ Start the Slack Client """ os.system("clear; figlet 'Slack Gitsin' | lolcat") history = FileHistory(os.path.expanduser("~/.slackHistory")) while True: text = prompt("slack> ", history=history, auto_suggest=AutoSuggestFromHistory(), on_abort=AbortAction.RETRY, style=DocumentStyle, completer=Completer(fuzzy_match=False, text_utils=TextUtils()), complete_while_typing=Always(), get_bottom_toolbar_tokens=get_bottom_toolbar_tokens, key_bindings_registry=manager.registry, accept_action=AcceptAction.RETURN_DOCUMENT ) slack = Slack(text) slack.run_command()
def main(): # required for travis tests if len(sys.argv) > 2 and sys.argv[-2] == 'scripts/configurator_tests/': sys.argv = [sys.argv[:-2]] args = parsers._config_arg_parser() if args.error: utils.error_level = 1 print("Starting Savu Config tool (please wait for prompt)") utils.populate_plugins() comp = Completer(commands=commands, plugin_list=pu.plugins) utils._set_readline(comp.complete) content = Content(level="all" if args.disp_all else 'user') # if file flag is passed then open it here if args.file: commands['open'](content, args.file) print("\n*** Press Enter for a list of available commands. ***\n") while True: in_list = raw_input(">>> ").strip().split(' ', 1) command, arg = in_list if len(in_list) is 2 else in_list + [''] command = command if command else 'help' if command not in commands: print("I'm sorry, that's not a command I recognise. Press Enter " "for a list of available commands.") else: content = commands[command](content, arg) if content.is_finished(): break # write the history to the history file utils.readline.write_history_file(utils.histfile) print("Thanks for using the application")
def __init__(self): """Initialize Tab with layout and behavior.""" super(Tab, self).__init__() # regex pattern for SQL query block comments self.block_comment_re = re.compile( r'(^)?[^\S\n]*/(?:\*(.*?)\*/[^\S\n]*|/[^\n]*)($)?', re.DOTALL | re.MULTILINE) main_layout = QVBoxLayout(self) # define gdb props self.gdb = None self.gdb_items = None self.gdb_columns_names = None self.gdb_schemas = None # connected geodatabase path toolbar self.connected_gdb_path_label = QLabel('') self.connected_gdb_path_label.setTextInteractionFlags( Qt.TextSelectableByMouse) self.connected_gdb_path_label.setToolTip( 'Connected geodatabase that queries will be run against') self.connected_gdb_path_label.setText(not_connected_to_gdb_message) self.browse_to_gdb = QPushButton('Browse') self.browse_to_gdb.setShortcut(QKeySequence('Ctrl+B')) self.browse_to_gdb.clicked.connect( lambda evt, arg=True: self.connect_to_geodatabase( evt, triggered_with_browse=True)) self.gdb_sql_dialect_combobox = QComboBox() for dialect in sql_dialects_names: self.gdb_sql_dialect_combobox.addItem(dialect) self.gdb_browse_toolbar = QToolBar() self.gdb_browse_toolbar.setMaximumHeight(50) self.gdb_browse_toolbar.addWidget(self.browse_to_gdb) self.gdb_browse_toolbar.addWidget(self.connected_gdb_path_label) self.gdb_browse_toolbar.addSeparator() self.gdb_browse_toolbar.addWidget(self.gdb_sql_dialect_combobox) # table with results self.table = ResultTable() # execute SQL query self.execute = QAction('Execute', self) self.execute.setShortcuts( [QKeySequence('F5'), QKeySequence('Ctrl+Return')]) self.execute.triggered.connect(self.run_query) self.addAction(self.execute) # enter a SQL query self.query = TextEditor() self.query.setPlainText('') font = self.query.font() font.setFamily('Consolas') font.setStyleHint(QFont.Monospace) # TODO: add line numbers to the text editor font.setPointSize(14) self.query.setFont(font) self.query.setTabStopWidth(20) self.highlighter = Highlighter(self.query.document()) # TODO select block of text - Ctrl+/ and they become comments self.completer = Completer() self.query.set_completer(self.completer.completer) # errors panel to show if query fails to execute properly self.errors_panel = QPlainTextEdit() font = self.query.font() font.setPointSize(12) self.errors_panel.setStyleSheet('color:red') self.errors_panel.setFont(font) self.errors_panel.hide() # splitter between the toolbar, query window, and the result set table splitter = QSplitter(Qt.Vertical) splitter.addWidget(self.gdb_browse_toolbar) splitter.addWidget(self.query) splitter.addWidget(self.table) splitter.addWidget(self.errors_panel) # add the settings after the widget have been added splitter.setCollapsible(0, True) splitter.setCollapsible(1, False) splitter.setCollapsible(2, False) splitter.setCollapsible(3, False) splitter.setStretchFactor(0, 3) splitter.setStretchFactor(1, 7) splitter.setSizes((100, 200, 300)) self.table.hide() # TOC self.toc = QTreeWidget() self.toc.setHeaderHidden(True) # second splitter between the TOC to the left and the query/table to the # right toc_splitter = QSplitter(Qt.Horizontal) toc_splitter.addWidget(self.toc) toc_splitter.addWidget(splitter) toc_splitter.setCollapsible(0, True) toc_splitter.setSizes((200, 800)) # set the TOC vs data panel main_layout.addWidget(toc_splitter) margins = QMargins() margins.setBottom(10) margins.setLeft(10) margins.setRight(10) margins.setTop(10) main_layout.setContentsMargins(margins) self.setLayout(main_layout) QApplication.setStyle(QStyleFactory.create('Cleanlooks')) self.show() return
def play_next(): if __last_played: keys = COUBS.keys() i = keys.index(__last_played) if i < len(COUBS) - 1: play(COUBS[keys[i + 1]]['permalink']) else: play(COUBS[keys[0]]['permalink']) elif len(COUBS) > 0: play(COUBS.itervalues().next()['permalink']) else: print 'nothing to play, get some coubs using get command' if __name__ == '__main__': readline.set_completer(Completer(__autocomplete_dict).complete) if sys.platform == 'darwin': readline.parse_and_bind('bind ^I rl_complete') else: readline.parse_and_bind('tab: complete') print """ Howdy! Start with \"get newest\" command and \"play\" some coubs, e.g. \"play 2vf1v\". To quit player screen press \"q\". Btw, autocomplete activated. """ while True: x = raw_input('> ') if x.startswith('get hot'):