Ejemplo n.º 1
0
 def open_ico(self): #引入ICO
     try:
         fileName1 = QFileDialog.getOpenFileName(self,
                                                           "Open ICO",
                                                 g.cur_file_dir()+"\ICO",
                                                           "ICO Files (*.ico)")   #设置文件扩展名过滤,注意用双分号间隔
         if not self.re_select(g.cur_file_dir().replace("\\","/"),str(fileName1)):
             msg.msg_box(u"操作提示",u"请本目录下ICO!")
             return
         name_file=g.cur_file_dir()   #当前程序路径
         fileName1=str(fileName1)[len(str(name_file))+1:]
         self.ico_path=str(fileName1)
         from os.path import isfile
         if isfile(self.ico_path):
             try:
                 # 你的代码
                 # path=QPixmap(r'%s'%(str(self.ico_path)))
                 # self.label_ICO.setPixmap(path)
                 # self.label_ICO.resize(path.width(),path.height())
                 self.label_ICO.setStyleSheet("background: transparent url(%s) no-repeat center center;"%(str(self.ico_path)))
             except BaseException, e:
                 pass
         #from os.path import isfile
         #if isfile(self.saveHistoryFilename):
     except BaseException, e:
         log.logging.debug("except:%s"%(str(e)))
Ejemplo n.º 2
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)))
Ejemplo n.º 3
0
 def add_shell(self, open_file, split):  #添加数据
     try:
         i_ok = 0
         i_no = 0
         for xxx_line in open_file.readlines():
             try:
                 data = xxx_line.strip().lstrip()
                 line = data.split(str(split))
                 type_id_id = self.type_id.currentIndex()
                 type_id = self.list_data[type_id_id - 1]
                 script = self.GetExt(str(line[0]))  #判断文件编码
                 sql_data="insert into sitetable(type_id,siteurl,sitepass,link,config,remarks,script,coding,createtime) " \
                          "VALUES(%s,'%s','%s','%s','%s','%s','%s','%s','%s')" \
                          %(str(type_id),str(line[0]),str(line[1]),"2","","",script,"65001",str(time.time()))
                 if self.shell_sql.mysqlite3_insert(sql_data):
                     i_ok += 1
                 else:
                     i_no += 1
             except BaseException, e:
                 log.logging.debug("except:%s" % (str(e)))
         msg.msg_lower_Left(u"添加数据成功%s条  失败%s条" %
                            (str(i_ok), str(i_no)))  #设置状态栏文字信息
         msg.msg_box(u"提示", u"添加数据成功%s条  失败%s条" % (str(i_ok), str(i_no)))
         #tableWidget_work.add_tableWidget(str(ui.treeWidget_id))   #加载当前列表
         tableWidget_work.reload_tree()  #加载目录
Ejemplo n.º 4
0
 def save_shell(self):  #保存文件
     try:
         name=self.name_lineEdit.text()
         file_dataX=self.data_textEdit.toPlainText()
         file_data=base64.b64encode(str(file_dataX))
         #name3=name.replace("\\","\\\\") #Route_File
         name2=g.file_GetExt(str(name))#输入路径地址  转换路径
         if self.script=="PHP":
             psot_data=link_shell.GetPostText(self.script,"Route_File")    #保存文件
             psot_data="%s&z1=%s&z2=%s"% \
                       (link_shell.post_php_data(psot_data),base64.b64encode(str(name2)),urllib.quote(str(file_data)))
         if self.script=="ASP":
             psot_data=link_shell.GetPostText(self.script,"Route_File")    #保存文件
             psot_data="%s&z1=%s&z2=%s"% \
                       (psot_data,binascii.b2a_hex(str(name2)),binascii.b2a_hex(str(file_dataX)))
         if self.script=="ASPX":
             psot_data=link_shell.GetPostText(self.script,"Route_File")    #保存文件
             psot_data="%s&z1=%s&z2=%s"% \
                       (psot_data,urllib.quote(base64.b64encode(str(name2).replace('\\', '\\\\'))),urllib.quote(str(file_dataX)))
         FALSE_bool,ResInfo=eval_link.Post_eval_php(str(self.id),psot_data) #获取 请求内容
         if not ((FALSE_bool==0) and (str(ResInfo)=="1")):
             if "ERROR:" in ResInfo:
                 msg.msg_lower_Left(u"%s错误 %s"%(str(name2),str(ResInfo)))#设置状态栏文字信息
                 msg.msg_box(u"错误提示",str(ResInfo))  #错误提示
             else:
                 msg.msg_lower_Left(u"%s文件写入完成"%(str(name2)))#设置状态栏文字信息
             #self.data_textEdit.setPlainText(u'%s'%(ResInfo))
             #Edit_file_ui.Edit_file(id=self.id,data=ResInfo,name=name)  #编辑这个文件
         else:
             msg.msg_lower_Left(u"%s文件写入错误"%(str(name2)))#设置状态栏文字信息
     except BaseException, e:
         log.logging.debug("except:%s"%(str(e)))
Ejemplo n.º 5
0
    def Dexport(self, open_file):  #导出数据
        try:
            #self.main_ui
            type_id_id = self.type_id.currentIndex()
            type_id = self.list_data[type_id_id - 1]  #获取ID
            sql_data = "select * from sitetable WHERE type_id='%s' order by `updatetime` desc" % (
                str(type_id))  # asc 表示升序 , desc表示降序
            self.shell_sql.conn.commit()  # 获取到游标对象
            cur = self.shell_sql.conn.cursor()  # 用游标来查询就可以获取到结果
            cur.execute(sql_data)  # 获取所有结果
            res = cur.fetchall()  #从结果中取出所有记录
            cur.close()  #关闭游标
            data = ""
            for line in res:
                url_pass = "******" % (str(line[2]), str(
                    self.radio_id), str(line[3]))
                data += url_pass + "\r\n"

            if self.TXT_file2(open_file, data):
                msg.msg_lower_Left(u"导出SHELL %s 成功" %
                                   (str(open_file)))  #设置状态栏文字信息
                msg.msg_box(u"导出SHELL", u"导出SHELL %s 成功" % (str(open_file)))
            else:
                msg.msg_lower_Left(u"导出SHELL %s 失败" %
                                   (str(open_file)))  #设置状态栏文字信息
                msg.msg_box(u"导出SHELL", u"导出SHELL %s 失败" % (str(open_file)))
        except BaseException, e:
            log.logging.debug("except:%s" % (str(e)))
Ejemplo n.º 6
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)))
Ejemplo n.º 7
0
 def add_shell(self,open_file,split):#添加数据
     try:
         i_ok=0
         i_no=0
         for xxx_line in open_file.readlines():
             try:
                 data=xxx_line.strip().lstrip()
                 line = data.split(str(split))
                 type_id_id=self.type_id.currentIndex()
                 type_id=self.list_data[type_id_id-1]
                 script=self.GetExt(str(line[0])) #判断文件编码
                 sql_data="insert into sitetable(type_id,siteurl,sitepass,link,config,remarks,script,coding,createtime) " \
                          "VALUES(%s,'%s','%s','%s','%s','%s','%s','%s','%s')" \
                          %(str(type_id),str(line[0]),str(line[1]),"2","","",script,"65001",str(time.time()))
                 if self.shell_sql.mysqlite3_insert(sql_data):
                     i_ok+=1
                 else:
                     i_no+=1
                 ss="add OK:%s--NO:%s"%(str(i_ok),str(i_no))
                 self.shell_add.setText(ss)
             except BaseException, e:
                 log.logging.debug("except:%s"%(str(e)))
         msg.msg_lower_Left(u"添加数据成功%s条  失败%s条"%(str(i_ok),str(i_no)))#设置状态栏文字信息
         msg.msg_box(u"提示",u"添加数据成功%s条  失败%s条"%(str(i_ok),str(i_no)))
         #tableWidget_work.add_tableWidget(str(ui.treeWidget_id))   #加载当前列表
         tableWidget_work.reload_tree()  #加载目录
Ejemplo n.º 8
0
    def add_Button(self):
        try:
            if self.type_id.currentIndex()==0 or \
               self.script.currentIndex()==0 or \
               self.coding.currentIndex()==0:
               msg.msg_box(u"操作提示",u"请注意选择 脚本类型 和 字符编码!")
            else:
                siteurl=unicode(QtCore.QString(self.siteurl.toPlainText())) #URL
                sitepass=unicode(QtCore.QString(self.sitepass.text()))  #密码
                config=unicode(QtCore.QString(self.config.toPlainText()))   #配置
                #remarks=unicode(QtCore.QString(self.remarks.toPlainText().toLocal8Bit()))   #在备注
                remarks=unicode(self.remarks.toPlainText())   #在备
                #type_id=unicode(QtCore.QString(self.type_id.currentText())) #类别
                type_id_id=self.type_id.currentIndex()
                #print type_id_id
                type_id=self.list_data[type_id_id-1]
                #print self.json_data.has_key(str(type_id_id))
                #script=unicode(QtCore.QString(self.script.currentText()))  #脚本类型  asp   php
                #script=self.script.currentIndex()  #脚本类型  asp   php
                script=self.script.currentText()
                if str(script)=="PHP(Eval)":
                    script="1"
                elif str(script)=="ASP(Eval)":
                    script="2"
                elif str(script)=="ASPX(Eval)":
                    script="3"
                elif str(script)=="Customize":
                    script="4"
                #coding=unicode(QtCore.QString(self.coding.currentText()))   #编码方式
                #coding=self.coding.currentIndex()  #编码方式
                coding=self.coding.currentText()
                if str(coding)=="UTF-8":
                    coding="65001"
                elif str(coding)=="GB2312":
                    coding="936"
                elif str(coding)=="BIG5":
                    coding="950"
                elif str(coding)=="Euc-KR":
                    coding="949"
                elif str(coding)=="Euc-JP":
                    coding="20932"
                elif str(coding)=="Shift_JIS":
                    coding="932"
                elif str(coding)=="Windows-1251":
                    coding="1251"
                elif str(coding)=="Windows-874":
                    coding="874"
                elif str(coding)=="ISO-8859-1":
                    coding="1252"

                self.Box_click()  #选择保存配置信息
                if self.insert_update:   #0是True添加    1是False  修改
                    self.insert.emit(str(siteurl),str(sitepass),str(config),remarks,str(type_id),str(script),str(coding))  #添加获取文件名  并返回到主窗口
                else:
                    self.update.emit(str(self.id),str(siteurl),str(sitepass),str(config),remarks,str(type_id),str(script),str(coding))  #
                self.close()
        except BaseException, e:
            log.logging.debug("except:%s"%(str(e)))
Ejemplo n.º 9
0
 def open_link_Button(self):
     try:
         file_path=self.path_Edit.text()  #获取文件路径
         if str(file_path)=="file Utf-8":
             QtGui.QMessageBox.information(self, _fromUtf8(u"操作提示"),  _fromUtf8(u"请注意 请选择文件保存路径!"))#弹出对话框
             return
         if self.Import_export==1:  #导入
             if isfile(file_path):
                 try:
                     open_file = file(str(file_path), 'r')
                 except IOError, e:
                     msg.msg_box(u"操作提示",u"打开文件错误 %s"%(str(e)))
                     #msg.msg_box(u"操作提示",u"请注意 文件格式请选择另存为 UTF-8 模式!")
                     return
                 if self.radio_id=="5":
                     if self.textEdit.text()=="":  #获取文件路径
                         msg.msg_box(u"操作提示",u"请注意 自定义格式不能为空!")
                         return
                     self.radio_id==str(self.textEdit.text())
                 self.add_shell(open_file,str(self.radio_id))  #添加数据
         if self.Import_export==2:  #导出
             if self.radio_id=="5":
                 if self.textEdit.text()=="":  #获取文件路径
                     msg.msg_box(u"操作提示",u"请注意 自定义格式不能为空!")
                     return
                 self.radio_id==str(self.textEdit.text())
             self.Dexport(file_path)  #导出数据
Ejemplo n.º 10
0
 def open_link_Button(self):
     try:
         file_path = self.path_Edit.text()  #获取文件路径
         if str(file_path) == "file Utf-8":
             QtGui.QMessageBox.information(
                 self, _fromUtf8(u"操作提示"),
                 _fromUtf8(u"请注意 请选择文件保存路径!"))  #弹出对话框
             return
         if self.Import_export == 1:  #导入
             if isfile(file_path):
                 try:
                     open_file = file(str(file_path), 'r')
                 except IOError, e:
                     msg.msg_box(u"操作提示", u"打开文件错误 %s" % (str(e)))
                     #msg.msg_box(u"操作提示",u"请注意 文件格式请选择另存为 UTF-8 模式!")
                     return
                 if self.radio_id == "5":
                     if self.textEdit.text() == "":  #获取文件路径
                         msg.msg_box(u"操作提示", u"请注意 自定义格式不能为空!")
                         return
                     self.radio_id == str(self.textEdit.text())
                 self.add_shell(open_file, str(self.radio_id))  #添加数据
         if self.Import_export == 2:  #导出
             if self.radio_id == "5":
                 if self.textEdit.text() == "":  #获取文件路径
                     msg.msg_box(u"操作提示", u"请注意 自定义格式不能为空!")
                     return
                 self.radio_id == str(self.textEdit.text())
             self.Dexport(file_path)  #导出数据
Ejemplo n.º 11
0
    def Dexport(self,open_file): #导出数据
        try:
            type_id_id=self.type_id.currentIndex()
            type_id=self.list_data[type_id_id-1]  #获取ID
            sql_data = "select * from sitetable WHERE type_id='%s' order by `updatetime` desc"%(str(type_id))   # asc 表示升序 , desc表示降序
            self.shell_sql.conn.commit()# 获取到游标对象
            cur = self.shell_sql.conn.cursor()# 用游标来查询就可以获取到结果
            cur.execute(sql_data)# 获取所有结果
            res = cur.fetchall()  #从结果中取出所有记录
            cur.close()  #关闭游标
            data=""
            for line in res:
                url_pass="******"%(str(line[2]),str(self.radio_id),str(line[3]))
                data+=url_pass+"\r\n"

            if self.TXT_file2(open_file,data):
                msg.msg_lower_Left(u"导出SHELL %s 成功"%(str(open_file)))#设置状态栏文字信息
                msg.msg_box(u"导出SHELL",u"导出SHELL %s 成功"%(str(open_file)))
            else:
                msg.msg_lower_Left(u"导出SHELL %s 失败"%(str(open_file)))#设置状态栏文字信息
                msg.msg_box(u"导出SHELL",u"导出SHELL %s 失败"%(str(open_file)))
        except BaseException, e:
            log.logging.debug("except:%s"%(str(e)))
Ejemplo n.º 12
0
 def save_shell(self):  #保存文件
     try:
         name = self.name_lineEdit.text()
         file_dataX = self.data_textEdit.toPlainText()
         file_data = base64.b64encode(str(file_dataX))
         #name3=name.replace("\\","\\\\") #Route_File
         name2 = g.file_GetExt(str(name))  #输入路径地址  转换路径
         if self.script == "PHP":
             psot_data = link_shell.GetPostText(self.script,
                                                "Route_File")  #保存文件
             psot_data="%s&z1=%s&z2=%s"% \
                       (link_shell.post_php_data(psot_data),base64.b64encode(str(name2)),urllib.quote(str(file_data)))
         if self.script == "ASP":
             psot_data = link_shell.GetPostText(self.script,
                                                "Route_File")  #保存文件
             psot_data="%s&z1=%s&z2=%s"% \
                       (psot_data,binascii.b2a_hex(str(name2)),binascii.b2a_hex(str(file_dataX)))
         if self.script == "ASPX":
             psot_data = link_shell.GetPostText(self.script,
                                                "Route_File")  #保存文件
             psot_data="%s&z1=%s&z2=%s"% \
                       (psot_data,urllib.quote(base64.b64encode(str(name2).replace('\\', '\\\\'))),urllib.quote(str(file_dataX)))
         FALSE_bool, ResInfo = eval_link.Post_eval_php(
             str(self.id), psot_data)  #获取 请求内容
         if not ((FALSE_bool == 0) and (str(ResInfo) == "1")):
             if "ERROR:" in ResInfo:
                 msg.msg_lower_Left(u"%s错误 %s" %
                                    (str(name2), str(ResInfo)))  #设置状态栏文字信息
                 msg.msg_box(u"错误提示", str(ResInfo))  #错误提示
             else:
                 msg.msg_lower_Left(u"%s文件写入完成" % (str(name2)))  #设置状态栏文字信息
             #self.data_textEdit.setPlainText(u'%s'%(ResInfo))
             #Edit_file_ui.Edit_file(id=self.id,data=ResInfo,name=name)  #编辑这个文件
         else:
             msg.msg_lower_Left(u"%s文件写入错误" % (str(name2)))  #设置状态栏文字信息
     except BaseException, e:
         log.logging.debug("except:%s" % (str(e)))
Ejemplo n.º 13
0
    def add_Button(self):
        try:
            if self.type_id.currentIndex()==0 or \
               self.script.currentIndex()==0 or \
               self.coding.currentIndex()==0:
                msg.msg_box(u"操作提示", u"请注意选择 脚本类型 和 字符编码!")
            else:
                siteurl = unicode(QtCore.QString(
                    self.siteurl.toPlainText()))  #URL
                sitepass = unicode(QtCore.QString(self.sitepass.text()))  #密码
                config = unicode(QtCore.QString(
                    self.config.toPlainText()))  #配置
                #remarks=unicode(QtCore.QString(self.remarks.toPlainText().toLocal8Bit()))   #在备注
                remarks = unicode(self.remarks.toPlainText())  #在备
                #type_id=unicode(QtCore.QString(self.type_id.currentText())) #类别
                type_id_id = self.type_id.currentIndex()
                #print type_id_id
                type_id = self.list_data[type_id_id - 1]
                #print self.json_data.has_key(str(type_id_id))
                #script=unicode(QtCore.QString(self.script.currentText()))  #脚本类型  asp   php
                #script=self.script.currentIndex()  #脚本类型  asp   php
                script = self.script.currentText()
                if str(script) == "PHP(Eval)":
                    script = "1"
                elif str(script) == "ASP(Eval)":
                    script = "2"
                elif str(script) == "ASPX(Eval)":
                    script = "3"
                elif str(script) == "Customize":
                    script = "4"
                #coding=unicode(QtCore.QString(self.coding.currentText()))   #编码方式
                #coding=self.coding.currentIndex()  #编码方式
                coding = self.coding.currentText()
                if str(coding) == "UTF-8":
                    coding = "65001"
                elif str(coding) == "GB2312":
                    coding = "936"
                elif str(coding) == "BIG5":
                    coding = "950"
                elif str(coding) == "Euc-KR":
                    coding = "949"
                elif str(coding) == "Euc-JP":
                    coding = "20932"
                elif str(coding) == "Shift_JIS":
                    coding = "932"
                elif str(coding) == "Windows-1251":
                    coding = "1251"
                elif str(coding) == "Windows-874":
                    coding = "874"
                elif str(coding) == "ISO-8859-1":
                    coding = "1252"

                self.Box_click()  #选择保存配置信息
                if self.insert_update:  #0是True添加    1是False  修改
                    self.insert.emit(str(siteurl), str(sitepass), str(config),
                                     remarks, str(type_id), str(script),
                                     str(coding))  #添加获取文件名  并返回到主窗口
                else:
                    self.update.emit(str(self.id), str(siteurl), str(sitepass),
                                     str(config), remarks, str(type_id),
                                     str(script), str(coding))  #
                self.close()
        except BaseException, e:
            log.logging.debug("except:%s" % (str(e)))