def __init__(self): self.sets = {} self.parse_args() self.html = html.Html(self.args.html_dir, self.args.tsv_dir, sys.argv[0]) self.tsv = tsv_output.TsvOutput(self.args.tsv_dir)
def weiboFollowing(id): global sended, sever url = 'http://m.weibo.cn/u/' + str(id) headers = { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Encoding": "gzip,deflate,sdch", "Accept-Language": "zh-CN,zh;q=0.8", "Cache-Control": "max-age=0", "Connection": "keep-alive", "Cookie": "_T_WM=67482dd32c104ee6452160ff87248f3b; M_WEIBOCN_PARAMS=featurecode%3D20000181%26rl%3D1%26luicode%3D10000011%26lfid%3D1005051843543427%26fid%3D1005051843543427%26uicode%3D10000011", "Host": "m.weibo.cn", "User-Agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36 LBBROWSER" } print url handle = html.Html() #data = handle.get(url,'') data = handle.post(url, {'': ''}, headers) #print gzdecode(data) url = 'http://m.weibo.cn/page/card?itemid=1005051843543427_-_WEIBO_INDEX_PROFILE_WEIBO_GROUP_OBJ' data = handle.get(url, '') data = data.replace('"}', '').replace('{"ok":"1","data":"', '') #sys.exit() sData = BeautifulSoup.BeautifulSoup(data) lists = sData.find('article', {}) firstDiv = lists.div print firstDiv sys.exit() userName = firstDiv.a.contents[0] content = replaceSign(firstDiv.a.nextSibling, 0) time = replaceSign(firstDiv.find('span', {'class': 'info'}).contents[0]) if time <= dateToday(): #sms.SMS().sendSMS(content) to = '*****@*****.**' subj = 'New message from ' + userName + ' in weibo' text = content if text not in sended: try: myEmail.sendmessage(server, subj, text, to) sended.append(text) except Exception, e: print e
def run(self): if '--verbose' in sys.argv: self.output.test('Injection Attacks...') try: rfi.Rfi(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, links=self.links, cookie=self.cookie).run() xss.Xss(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, links=self.links, cookie=self.cookie).run() php.PHP(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, links=self.links, cookie=self.cookie).run() sql.Sql(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, links=self.links, cookie=self.cookie).run() ldap.Ldap(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, links=self.links, cookie=self.cookie).run() html.Html(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, links=self.links, cookie=self.cookie).run() xpath.Xpath(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, links=self.links, cookie=self.cookie).run() except Exception, e: pass
def run(self): print "" self.output.info('Starting attacks module...') rfi.Rfi(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, urls=self.url, cookie=self.cookie).run() sql.Sql(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, urls=self.url, cookie=self.cookie).run() xss.Xss(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, urls=self.url, cookie=self.cookie).run() php.Php(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, urls=self.url, cookie=self.cookie).run() ldap.LDAP(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, urls=self.url, cookie=self.cookie).run() html.Html(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, urls=self.url, cookie=self.cookie).run() xpath.Xpath(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, urls=self.url, cookie=self.cookie).run()
#coding:utf-8 import sys import html, time import BeautifulSoup import sms import os htmlHandle = html.Html() sms = sms.SMS() #url = 'http://store.apple.com/cn/browse/finance/installments' url = 'http://store.apple.com/cn_cmb/browse/finance/installments/cmb' dic = {} def checkRate(): try: content = htmlHandle.get(url, '') content = BeautifulSoup.BeautifulSoup(content) for tr in content.findAll('tr', {'class': 'row-container-upper'}): tds = tr.findAll('th') for i, td in enumerate(tds): times = td.contents[0] dic[i] = times.strip() for tr in content.findAll('tr', {'class': 'row-container-percentage'}): tds = tr.findAll('td') for i, td in enumerate(tds):
#coding:gbk import html import json urlopener = html.Html() with open('bjxiaoqu.txt', 'r') as xiaoqus: for xiaoqu in xiaoqus: try: xiaoquId, name = xiaoqu.split('\t') url = 'http://guazi.ganji.com/openapi/getPostByGeo/?token=1309227240229108184&lid=' + xiaoquId + '&type=1,2,3,4' result = json.loads(urlopener.get(url, '')) if result['data']['total'] > 0: print xiaoquId, name[:-1], result['data']['total'], result[ 'data']['list'].keys() else: #print xiaoquId,name[:-1],result['data']['total'] pass except Exception, e: print e
def CRMLogin(): params = {"UserName":gjname,"Domain":"@ganji.com","Password":gjpwd} url = "http://sso.ganji.com/Account/LogOn" crm = html.Html() crm.post(url,params,"") return crm
"options.sogotrade.com", "Pragma": "no-cache", "Referer": "http://options.sogotrade.com/Chain.aspx", "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0" } data = { 'chainType': '1', 'expiration': '"131213W"', 'isRotated': 'false', 'showBinary': 'true', 'showNonStandard': 'false', 'strike': 'null', 'strikes': 'null', 'strikesRange': '"1"', 'underlyingSymbol': '"QIHU"' } url = 'http://options.sogotrade.com/Services/ChainService.asmx/GetOptions' h2 = html.Html() #url = 'https://account.sogotrade.com/Account/Default.aspx' #html = requests.post(url,data=data,headers=headers) #print h2.post(url,data,headers) html = requests.get(url) print html.text
#coding:utf-8 import sys, mySQLClass, time, html, os import re, time, urllib2, urllib, cookielib, json html = html.Html() '''getCookieUrl = 'http://bj.ganji.com/fang1/' html.get(getCookieUrl, '') print html.cj ''' #print a url = "http://www.aizhufu.cn/taskmanage/save_zhufu.jhtml" ''' tmp = BeautifulSoup.BeautifulSoup(htmlHandle.get(url, ""))(attrs={"type":"hidden"})[1] name = tmp['name'] value = tmp['value'] ''' params = { 'customContent': 'Hello', 'recipients': '13333219452', 'urlRedirect': '' } headers = { 'Accept': 'application/json, text/javascript, */*', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3', 'Cache-Control': 'no-cache',
def style(self, element, **attributes): s = "" if attributes: for k, v in attributes.items(): s += " " + k + ": " + v + ";\n" self.printer(element + " {") self.printer(s + "}") def content(self, text): self.printer(str(text)) if __name__ == "__main__": # example use import html h = html.Html(lambda x: print(x)) h.tag2("!DOCTYPE", html="") h.tag2("meta", charset="utf8") with h.tag("html"): with h.tag("head"): with h.tag("title"): h.content("I am the title") with h.tag("style"): h.style("h1", color="red") with h.tag("body"): with h.tag("h1"): h.content("I am red") with h.tag("p.a.b.c"): h.content("Paragraph text.") h.tag2("br") with h.tag("a", href="https://google.com"):
#coding:utf-8 import html,os headers = { "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Encoding":"gzip, deflate", "Accept-Language":"zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3", "Cache-Control":"max-age=0", "Connection":"keep-alive", "Cookie":"gj_inner_acc=1-3218; __utma=32156897.922795486.1373282254.1373349227.1373356621.4; __utmz=32156897.1373282254.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); ganji_uuid=7317481816123928727508-287307261; _gl_tracker=%7B%22sid%22%3A50026929814%7D; __utmc=32156897; GDNETSSOC=userm=VyTZ2dihqf8gf7TmQ8GB7CmmvYA4/HaXRZacxgYV8yx0wz9zEoGogNK4dHdnukt5; GANJISESSID=b058a88bc6b334435358979b235d67d4", "Host":"stat.corp.ganji.com", "User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0" } #url = "http://stat.corp.ganji.com/CustomBaseReportManagement/CustomBaseReportManager?reportId=20035" url = "http://stat.corp.ganji.com/" post = { 'page':'1', 'para_filter':'"day_dt_stat_date":"2013/7/8","day_dt_end_date":"2013/7/8","city_key":"0","category_key":"7","source":"total"', 'size':'20' } statHandle = html.Html() print statHandle.post(url,"",headers) #print statHandle.get('http://stat.corp.ganji.com//SEOTrace/KeywordManagement','') #os.system('start ' + url)
#coding:utf-8 import sms, html, hive, time, json, sys params = { "UserName": "******", "Domain": "@ganji.com", "Password": "******" } url = "http://sso.ganji.com/Account/LogOn" stat = html.Html() stat.post(url, params, "") stat.headerConf({'X-Requested-With': 'XMLHttpRequest'}) sourceURL = 'http://stat.corp.ganji.com/CustomBaseReportManagement/GetCustomBaseReportData?reportId=20035' #seoURL = 'http://stat.corp.ganji.com/KendoUI/ReportViz?reportId=20051' day_dt_stat_date = time.strftime('%Y-%m-%d', time.localtime(time.time() - 86400 * 7)) day_dt_end_date = time.strftime('%Y-%m-%d', time.localtime(time.time() - 86400 * 1)) sources = ['dh', 'seo', 'ganji_edm', 'unknown', 'sem', 'sns', 'total', 'self'] sources = ['seo'] detail = '' operation = '' Judgmentdetail = detail def getDates(day_dt_stat_date, day_dt_end_date):
# coding=utf-8 import time import os import html docHtml = html.Html() # Dibuja las torres. def dibujarTorres(): global docHtml for x in range(len(torres)): if x == 0: espaciox = 0 espacioy = 0 espacioz = 0 for k in range(len(torres)): for j in range(len(torres[k])): if j == 0: if torres[k][j] != 0: espaciox = espaciox + 1 elif j == 1: if torres[k][j] != 0: espacioy = espacioy + 1 elif j == 2: if torres[k][j] != 0: espacioz = espacioz + 1 espacio = (7 * 20) - (len(torres[x]) * 20) docHtml.colx += """<div id="nube"></div>\n\t<div id="torres">\n\t<div id="t1" class="contenidoTorre">\n\t<div style='height:""" + str( (7 * 20) - (espaciox * 20)) + """px'></div>\n"""
dateSerch = dateToday[:-2] + '0' + dateSerch day = [31, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 ,31] dateStart = dateSerch[:-2] + str (day[int(dateSerch[-2:]) - 3]) dateEnd = dateSerch[:-2] + str (day[int(dateSerch[-2:]) + 1]) #print dateStart,dateEnd import html params = {"UserName":"******","Domain":"@ganji.com","Password":"******"} url = "http://sso.ganji.com/Account/LogOn" crm = html.Html() crm.post(url,params,"") if not email : sys.exit() params = {'[Equal]Email':email,'accountListType':'2','page':'1','pagesize':'20','sortname':'CreatedTime','sortorder':'desc','unnamed':'none'} url = "http://gcrm.ganji.com/HousingAccount/Items?listType=ForManagers" creatorId = json.loads(crm.post(url,params,""))['Rows'][0]['Id'] crm.clear() #operationTypeNum = raw_input('查找操作类型: 0->精品刷新 1->放心房刷新 2->发布/删除帖子 3->推广/取消推广 4->自定义\n') operationTypes = {"user-edit":"编辑房源","user-add-refresh":"新增精品刷新","user-del-refresh":"取消精品刷新", "user-add-refresh-assure":"新增放心房刷新","user-del-refresh-assure":"取消放心房刷新", "user-add":"发布房源","user-delete":"删除房源", "user-start-premier":"参与推广","user-cancel-premier":"取消推广",'user-del-repeat-house':"取消选择推广期内重复刷新",'user-add-repeat-house':"设置推广期内重复刷新"}
def __init__(self): #Login self.hive = html.Html() self.hive.post(self.urlLogin, self.paramsLogin, "")
#coding:utf-8 import html handle = html.Html() selecturl = 'http://api.map.baidu.com/geodata/v2/poi/list' delurl = 'http://api.map.baidu.com/geodata/v2/poi/delete' addurl = 'http://api.map.baidu.com/geodata/v2/poi/upload' data = {'ak': 'BC5f181e1e57cfe86deac47428b9793b', 'geotable_id': 38979} adddata = { 'ak': 'BC5f181e1e57cfe86deac47428b9793b', 'geotable_id': 38979, 'poi_list': 'data.csv' } print handle.get(selecturl, data) ''' for i in range(1,8): handle.post(delurl,data,'') ''' #print handle.post(addurl,adddata,'') ''' createurl = 'http://api.map.baidu.com/geodata/v2/poi/create' with open('data_one.csv','r') as datas: for data in datas: title,address,longitude,latitude,coord_type,expired,xiaoqu_id,xiaoqu_url,sell_num,rent_num,avg_price,sell_houses,rent_houses,picture = data.split('\t') #print title data = {'ak':'BC5f181e1e57cfe86deac47428b9793b','geotable_id':38979,'title':title,'address':address,'longitude':longitude,'latitude':latitude,'coord_type':coord_type,'expired':expired,'xiaoqu_id':xiaoqu_id,'xiaoqu_url':xiaoqu_url,'sell_num':sell_num,'rent_num':rent_num,'avg_price':avg_price,'sell_houses':sell_houses,'rent_houses':rent_houses,'picture':picture} #print data print handle.post(createurl,data,'')
g.graph_attr['fontname'] = 'Matura MT Script Capitals' g.graph_attr['fontcolor'] = 'saddlebrown' g.node_attr['shape'] = 'egg' g.node_attr['peripheries'] = '1' g.node_attr['color'] = 'rosybrown' g.node_attr['orientation'] = '12' g.node_attr['fontcolor'] = 'darkslateblue' g.node_attr['fontname'] = 'Comic Sans MS' g.edge_attr['fontname'] = 'Lucida Handwriting' g.layout(prog='dot') stringFile = '%d' % order + '-' + outset g.write(stringFile + '.dot') lines = open(stringFile + '.dot').readlines() # 打开文件,读入每一行 fp = open(stringFile + '.dot', 'w') for s in lines: fp.write(s.replace('\n', ' ')) # 换行替换为空格 fp.close() # 关闭文件 g.draw('%d' % order + '-' + outset + '.jpg') if __name__ == '__main__': getReverseFile(sys.argv[1]) read() FindMainFunctions() paintMainGraph(arr, GetEntryPoint(sys.argv[1])) FindSubFunctions() html.Html()