Esempio n. 1
0
 def while_export_shell(self):  #选择导出
     try:
         data=""
         self.window = QtGui.QMainWindow()
         files= QFileDialog.getSaveFileName(self.window,
                                            u"文件保存",
                                            u"%s\\"%(g.cur_file_dir()),
                                            "Text Files (*.txt)")
         if len(files):
             int_model = self.main_ui.tableWidget.selectionModel()  #获取选中编号
             if len(int_model.selectedRows())>=1:
                 for index in int_model.selectedRows():       #// 对于被选中的每一行
                     try:
                         int_index=index.row()#获取行号
                         ID=self.main_ui.tableWidget.item(int(int_index),0).text()  #获取某一格内容
                         #print ID
                         self.id_shell_list=db_shell.id_sitetable_shell(str(ID))  #通过ID查询SHELL的状态
                         #self.id=str(self.id_shell_list[0])         #自动编号
                         #self.type_id=str(self.id_shell_list[1])    #      类别
                         self.siteurl=str(self.id_shell_list[2])    #    网址
                         self.sitepass=str(self.id_shell_list[3])   #    密码
                         data+="%s|%s\r\n"%(str(self.siteurl),str(self.sitepass))
                     except BaseException, e:
                         pass
                 if self.TXT_file2(files,data):
                     msg.msg_lower_Left(u"导出SHELL %s 成功"%(str(files)))#设置状态栏文字信息
                     msg.msg_box(u"导出SHELL",u"导出SHELL %s 成功"%(str(files)))
                 else:
                     msg.msg_lower_Left(u"导出SHELL %s 失败"%(str(files)))#设置状态栏文字信息
                     msg.msg_box(u"导出SHELL",u"导出SHELL %s 失败"%(str(files)))
     except BaseException, e:
         log.logging.debug("except:%s"%(str(e)))
Esempio n. 2
0
    def __init__(self,**kwargs):
        super(Edit_file, self).__init__()
        self.main_ui=ui.UIManager.get_ui('main_ui') #主程序UI
        # self.shell_sql=UIManager.shell_sql
        self.ShowFile_ui = uic.loadUi("ui/Edit_file.ui", self)#动态加标签
        self.main_ui.tabWidget.addTab(self.ShowFile_ui,QIcon('system/file_Edit.ico'),u"%s"%(g.path_name(u'%s'%(kwargs['name']))))
        self.main_ui.tabWidget.setCurrentIndex(self.main_ui.tabWidget.count()-1)#显示当前页
        #self.data_textEdit.setAcceptRichText(True)  #设置成纯文本
        try:
            if "data" in kwargs:  #内容
                #self.plainTextEdit.setText(u'%s'%(kwargs['data']))
                self.data_textEdit.setPlainText(u'%s'%(kwargs['data']))
            if "name" in kwargs:  #文件路径
                self.name_lineEdit.setText(u'%s'%(kwargs['name']))

            self.id_shell_list=db_shell.id_sitetable_shell('%s'%(kwargs['ID']))  #通过ID查询SHELL的状态
            self.id=str(self.id_shell_list[0])         #自动编号
            #self.type_id=str(self.id_shell_list[1])    #      类别
            self.siteurl=str(self.id_shell_list[2])    #    网址
            self.sitepass=str(self.id_shell_list[3])   #    密码
            #self.link=str(self.id_shell_list[4])         #链接状态
            #self.ip=str(self.id_shell_list[5])         #    ip地址
            #self.config=str(self.id_shell_list[6])     #    配置
            #self.coding=str(self.id_shell_list[7])     #  编码方式
            self.script=str(self.id_shell_list[8])      #   asp   php
            ###########################################
            #事件响应
            self.load_Button.clicked.connect(self.load_shell)  #载入路径
            self.save_Button.clicked.connect(self.save_shell)  #保存文件
            ###########################################
        except BaseException, e:
            log.logging.debug("except:%s"%(str(e)))
Esempio n. 3
0
 def while_export_shell(self):  #选择导出
     try:
         data=""
         self.window = QtGui.QMainWindow()
         files= QFileDialog.getSaveFileName(self.window,
                                            u"文件保存",
                                            u"%s\\"%(g.cur_file_dir()),
                                            "Text Files (*.txt)")
         if len(files):
             int_model = self.main_ui.tableWidget.selectionModel()  #获取选中编号
             if len(int_model.selectedRows())>=1:
                 for index in int_model.selectedRows():       #// 对于被选中的每一行
                     try:
                         int_index=index.row()#获取行号
                         ID=self.main_ui.tableWidget.item(int(int_index),0).text()  #获取某一格内容
                         #print ID
                         self.id_shell_list=db_shell.id_sitetable_shell(str(ID))  #通过ID查询SHELL的状态
                         #self.id=str(self.id_shell_list[0])         #自动编号
                         #self.type_id=str(self.id_shell_list[1])    #      类别
                         self.siteurl=str(self.id_shell_list[2])    #    网址
                         self.sitepass=str(self.id_shell_list[3])   #    密码
                         data+="%s|%s\r\n"%(str(self.siteurl),str(self.sitepass))
                     except BaseException, e:
                         pass
                 if self.TXT_file2(files,data):
                     msg.msg_lower_Left(u"导出SHELL %s 成功"%(str(files)))#设置状态栏文字信息
                     msg.msg_box(u"导出SHELL",u"导出SHELL %s 成功"%(str(files)))
                 else:
                     msg.msg_lower_Left(u"导出SHELL %s 失败"%(str(files)))#设置状态栏文字信息
                     msg.msg_box(u"导出SHELL",u"导出SHELL %s 失败"%(str(files)))
     except BaseException, e:
         log.logging.debug("except:%s"%(str(e)))
Esempio n. 4
0
def Post_eval_php(ID, params):  #POST 提交内容
    try:
        id_shell_list = db_shell.id_sitetable_shell('%s' %
                                                    (str(ID)))  #通过ID查询SHELL的状态
        #id=str(id_shell_list[0])         #自动编号
        #type_id=str(self.id_shell_list[1])    #      类别
        url = str(id_shell_list[2])  #    网址
        PASS = str(id_shell_list[3])  #    密码
        #ip=str(id_shell_list[4])         #    ip地址
        #config=str(id_shell_list[5])     #    配置
        coding = str(id_shell_list[6])  #  编码方式
        #script=str(id_shell_list[7])      #   asp   php
        headers = {'content-type': 'application/x-www-form-urlencoded'}
        #values = {SitePass:Data}#得密码post内容
        values = PASS + params  #上面的方式会进行自动URL编码所以用这种方式+ "="
        #req = requests.post(str(url), values, headers=headers, timeout=10)#强制转换为str
        req = requests.post(str(url),
                            values,
                            headers=headers,
                            timeout=int(ui.link_shell_timeout))  #强制转换为str
        if str(req.status_code) != "200":
            data = u"%s\n%s" % (str(req.status_code), str(req.headers))
            return 0, str(data)
        else:
            if coding == "65001":
                req.encoding = 'UTF-8'
            elif coding == "936":
                req.encoding = 'GB2312'
            elif coding == "950":
                req.encoding = 'BIG5'
            elif coding == "949":
                req.encoding = 'Euc-KR'
            elif coding == "20932":
                req.encoding = 'Euc-JP'
            elif coding == "932":
                req.encoding = 'Shift_JIS'
            elif coding == "1251":
                req.encoding = 'Windows-1251'
            elif coding == "874":
                req.encoding = 'Windows-874'
            elif coding == "1252":
                req.encoding = 'ISO-8859-1'
            else:
                req.encoding = 'GB2312'

            one_page = req.text

            real_page = GetRealTxt("->|", "|<-", str(one_page))
            if str(real_page) == "False":
                data = u"HTTP /1.1 OK\n%s\n%s" % (str(
                    req.headers), str(req.text))
                return 0, str(data)
            else:
                return 1, str(real_page)
    except BaseException, e:
        #log.logging.debug("except:%s"%(str(e)))
        return 0, str("LINK SHELL error:" + str(e))
Esempio n. 5
0
def Post_eval_php(ID,params):  #POST 提交内容
    try:
        id_shell_list=db_shell.id_sitetable_shell('%s'%(str(ID)))  #通过ID查询SHELL的状态
        #id=str(id_shell_list[0])         #自动编号
        #type_id=str(self.id_shell_list[1])    #      类别
        url=str(id_shell_list[2])    #    网址
        PASS=str(id_shell_list[3])   #    密码
        #ip=str(id_shell_list[4])         #    ip地址
        #config=str(id_shell_list[5])     #    配置
        coding=str(id_shell_list[6])     #  编码方式
        #script=str(id_shell_list[7])      #   asp   php
        headers = {'content-type': 'application/x-www-form-urlencoded'}
        #values = {SitePass:Data}#得密码post内容
        values = PASS  + params#上面的方式会进行自动URL编码所以用这种方式+ "="
        #req = requests.post(str(url), values, headers=headers, timeout=10)#强制转换为str
        req = requests.post(str(url), values, headers=headers, timeout=int(ui.link_shell_timeout))#强制转换为str
        if str(req.status_code)!="200":
            data=u"%s\n%s"%(str(req.status_code),str(req.headers))
            return 0,str(data)
        else:
            if coding=="65001":
                req.encoding = 'UTF-8'
            elif coding=="936":
                req.encoding = 'GB2312'
            elif coding=="950":
                req.encoding = 'BIG5'
            elif coding=="949":
                req.encoding = 'Euc-KR'
            elif coding=="20932":
                req.encoding = 'Euc-JP'
            elif coding=="932":
                req.encoding = 'Shift_JIS'
            elif coding=="1251":
                req.encoding = 'Windows-1251'
            elif coding=="874":
                req.encoding = 'Windows-874'
            elif coding=="1252":
                req.encoding = 'ISO-8859-1'
            else:
                req.encoding = 'GB2312'

            one_page = req.text

            real_page=GetRealTxt("->|", "|<-", str(one_page))
            if str(real_page)=="False":
                data=u"HTTP /1.1 OK\n%s\n%s"%(str(req.headers),str(req.text))
                return 0,str(data)
            else:
                return 1,str(real_page)
    except BaseException, e:
        #log.logging.debug("except:%s"%(str(e)))
        return 0,str("LINK SHELL error:"+str(e))
Esempio n. 6
0
    def __init__(self, **kwargs):
        super(Edit_file, self).__init__()
        self.main_ui = ui.UIManager.get_ui('main_ui')  #主程序UI
        # self.shell_sql=UIManager.shell_sql
        self.ShowFile_ui = uic.loadUi("ui/Edit_file.ui", self)  #动态加标签
        self.main_ui.tabWidget.addTab(
            self.ShowFile_ui, QIcon('system/file_Edit.ico'),
            u"%s" % (g.path_name(u'%s' % (kwargs['name']))))
        self.main_ui.tabWidget.setCurrentIndex(self.main_ui.tabWidget.count() -
                                               1)  #显示当前页
        #self.data_textEdit.setAcceptRichText(True)  #设置成纯文本
        try:
            if "data" in kwargs:  #内容
                #self.plainTextEdit.setText(u'%s'%(kwargs['data']))
                self.data_textEdit.setPlainText(u'%s' % (kwargs['data']))
            if "name" in kwargs:  #文件路径
                self.name_lineEdit.setText(u'%s' % (kwargs['name']))

            self.id_shell_list = db_shell.id_sitetable_shell(
                '%s' % (kwargs['ID']))  #通过ID查询SHELL的状态
            self.id = str(self.id_shell_list[0])  #自动编号
            #self.type_id=str(self.id_shell_list[1])    #      类别
            self.siteurl = str(self.id_shell_list[2])  #    网址
            self.sitepass = str(self.id_shell_list[3])  #    密码
            #self.link=str(self.id_shell_list[4])         #链接状态
            #self.ip=str(self.id_shell_list[5])         #    ip地址
            #self.config=str(self.id_shell_list[6])     #    配置
            #self.coding=str(self.id_shell_list[7])     #  编码方式
            self.script = str(self.id_shell_list[8])  #   asp   php
            ###########################################
            #事件响应
            self.load_Button.clicked.connect(self.load_shell)  #载入路径
            self.save_Button.clicked.connect(self.save_shell)  #保存文件
            ###########################################
        except BaseException, e:
            log.logging.debug("except:%s" % (str(e)))
Esempio n. 7
0
def shell_cs(x_ID):  #SHELL测试
    try:
        global I_OK,I_NO,list_ID,I_G,shell_on_off
        #for i in range(0, len(list_ID)):
        #id=list_ID[i]
        while True:
            try:
                id = list_ID.get(0.5)
                if not id:
                    break #跳出
                if list_ID.empty():   #判断队列是否为空
                    break #跳出
                id_shell_list=db_shell.id_sitetable_shell(str(id))  #通过ID查询SHELL的状态
                #siteurl=str(id_shell_list[2])    #    网址
                script=str(id_shell_list[8])      #   asp   php
                # if script=="PHP":
                #     psot_data=link_shell.post_php_data(str("@ini_set(\"display_errors\",\"0\");@set_time_limit(0);@set_magic_quotes_runtime(0);echo(\"->|\");echo(\"webxscan\");echo(\"|<-\");die();"))
                # elif script=="ASP":
                #     psot_data="=execute(\"response.clear:response.write(\"\"webxscan\"\"):response.end\")"
                # else:
                #     psot_data="=Response.Clear();Response.Write(\"webxscan\");"
                if script=="PHP":
                    psot_data=link_shell.GetPostText(script,"WebRoot")    #获取代码
                    psot_data=link_shell.post_php_data(psot_data)  #转换代码
                if script=="ASP":
                    psot_data=link_shell.GetPostText(script,"WebRoot")    #获取代码
                if script=="ASPX":
                    psot_data=link_shell.GetPostText(script,"WebRoot")    #获取代码
                FALSE_bool,Info=eval_link.Post_eval_php(str(id),psot_data) #获取 请求内容
                if FALSE_bool==0:
                    I_NO+=1
                    db_shell.SELECT_shell_link(str(id),0) #更新链接状态  0链接失败 1链接成功  2还未测试
                    sql_data="update sitetable set os='%s' where ID='%s'"%(str(""),str(id))
                else:
                    I_OK+=1
                    db_shell.SELECT_shell_link(str(id),1) #更新链接状态  0链接失败 1链接成功  2还未测试
                    OS_data=g.if_os(Info)
                    if OS_data=="":  #操作系统
                        #空
                        sql_data="update sitetable set os='%s' where ID='%s'"%(str("except"),str(id))
                    else:
                        #判断到操作系统
                        sql_data="update sitetable set os='%s' where ID='%s'"%(str(OS_data),str(id))
                if shell_sql.mysqlite3_update(sql_data):
                    pass
                    #msg.msg_lower_right(u"修改目录:%s 成功"%(str(name)))  #右下角提示
                else:
                    pass

                    # if(Info.find("webxscan") >= 0):
                    #     I_OK+=1
                    #     db_shell.SELECT_shell_link(str(id),1) #更新链接状态  0链接失败 1链接成功  2还未测试
                    #     db_shell.SELECT_shell_updatetime(str(id),str(siteurl))
                    # else:
                    #     I_NO+=1
                    #     db_shell.SELECT_shell_link(str(id),0) #更新链接状态  0链接失败 1链接成功  2还未测试
                if shell_on_off==0:
                    data=u"Thread:%d  shell测试   成功:%d  失败:%d  还有%d条需要测试  共计%d条"%(int(x_ID),int(I_OK),int(I_NO),int(I_G)-(int(I_OK)+int(I_NO)),int(I_G))#设置状态栏文字信息
                    #print data
                    msg.msg_lower_Left(data)#设置状态栏文字信息
            except BaseException, e:
                pass
        if shell_on_off==0:
            data=u"shell测试完成   成功:%d  失败:%d  共计%d条"%(int(I_OK),int(I_NO),int(I_G))#设置状态栏文字信息
            #print data
            msg.msg_lower_Left(data)#设置状态栏文字信息
            shell_on_off=1
            add_tableWidget(str(ui.treeWidget_id))   #加载当前列表