本文整理汇总了Python中lib.db.DB.fetchone方法的典型用法代码示例。如果您正苦于以下问题:Python DB.fetchone方法的具体用法?Python DB.fetchone怎么用?Python DB.fetchone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.db.DB
的用法示例。
在下文中一共展示了DB.fetchone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: system
# 需要导入模块: from lib.db import DB [as 别名]
# 或者: from lib.db.DB import fetchone [as 别名]
command1 = "mkdir " + webserver + mypath
system(command1)
androidagent = config.get('ANDROIDAGENT')
command = "cp " + androidagent + " " + webserver + mypath + myfile
system(command)
elif arsplit[1] == "IPHONE" :
pass
elif arsplit[1] == "BLACKBERRY" :
pass
elif arsplit[1] == "AGENTS" :
db = DB(config=config)
db.query("SELECT COUNT(*) from agents")
row = db.fetchone()[0]
fullpath2 = webserver + path + "/text2.txt"
CLEARFILE2 = open(fullpath2, 'w')
CLEARFILE2.close()
GETFILE = open(fullpath2, 'w')
if row == 0 :
GETFILE.write( key + " NONE\n")
GETFILE.close()
else :
GETFILE.write(key + " AGEN\n")
for i in range(1,row+1):
db.query("SELECT number from agents where id=" + i)
r = db.fetchone()[0]
db.query("SELECT controlkey from agents where id=" + i)
示例2: DB
# 需要导入模块: from lib.db import DB [as 别名]
# 或者: from lib.db.DB import fetchone [as 别名]
if line == "":
pass
else:
print line + "\n"
if select.select([sys.stdin, ], [], [], 0.5)[0]:
foo = sys.stdin().readline().strip()
if foo == "exit":
break
elif comm.lower == "sms":
command = agentkey + " " + "PORT" + " " + port1 + " " + foo
db = DB(config=config)
db.query("SELECT path from modems where id=" + modem)
path2 = db.fetchone()[0]
db.query("SELECT controlkey from modems where id=" + modem)
key2 = db.fetchone()[0]
number2 = agentnumber
db.query("SELECT type from modems where id=" + modem)
modemtype2 = db.fetchone()[0]
if modemtype2 == "usb":
usb = serial.serialposix(port='/dev/ttyUSB2', baudrate=115200,
bytesize=8, parity='N', stopbits=1)
usb.write("ATZ\r\n")
sleep(1)
line = read_modem(usb)
print line
sleep(1)
usb.write("AT+CMGF=1\r\n")
示例3: system
# 需要导入模块: from lib.db import DB [as 别名]
# 或者: from lib.db.DB import fetchone [as 别名]
command9 = "chmod 777 " + sploitfile
system(command9)
results = webserver + localpath + "/results"
command8 = "touch " + results
system(command8)
command9 = "chmod 777 " + results
system(command9)
sploitfiletext = "<?php\necho \"You Got Phished!\";\n$agent = $_SERVER['HTTP_USER_AGENT'];\n$page = " + x + ";\n$thing = $page . \" \" . $agent;\n$file = results;\n$current = file_get_contents($file);\n$current .= $thing . \"\\n\";\nfile_put_contents($file, $current);\n?>"
SPLOITFILE = open(sploitfile, 'w')
SPLOITFILE.write(sploitfiletext)
SPLOITFILE.close()
modem = 1
db = DB(config=config)
db.query("SELECT path from modems where id=%s", (modem,))
path2 = db.fetchone()[0].replace('"', '')
print path2
db.query("SELECT controlkey from modems where id=%s", (modem,))
key2 = db.fetchone()[0]
print key2
db.query("SELECT type from modems where id=%s", (modem,))
modemtype2 = db.fetchone()[0]
control = webserver + path2 + "/getfunc"
sleep(5)
with open(control, 'w') as f:
msg = "This is a cool page: "
command2 = key2 + " " + "SEND" + " " + x + " " + msg + link
f.write(command2)