MCPcopy
hub / github.com/Xyntax/POC-T / poc

Function poc

script/spider-example.py:25–52  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

23
24
25def poc(str):
26 url = 'http://space.bilibili.com/ajax/member/GetInfo?mid=' + str
27 head = {
28 'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36'
29 }
30
31 jscontent = requests.get(url, headers=head, verify=False).content
32 jsDict = json.loads(jscontent)
33 if jsDict['status'] and jsDict['data']['sign']:
34 jsData = jsDict['data']
35 mid = jsData['mid']
36 name = jsData['name']
37 sign = jsData['sign']
38 try:
39 conn = MySQLdb.connect(host='localhost', user='root', passwd='', port=3306, charset='utf8')
40 cur = conn.cursor()
41 conn.select_db('bilibili')
42 cur.execute(
43 'INSERT INTO bilibili_user_info VALUES (%s,%s,%s,%s)', [mid, mid, name, sign])
44 return True
45
46 except MySQLdb.Error, e:
47 pass
48 # print "Mysql Error %d: %s" % (e.args[0], e.args[1])
49 else:
50 # print "Pass: " + url
51 pass
52 return False

Callers

nothing calls this directly

Calls 2

getMethod · 0.80
connectMethod · 0.45

Tested by

no test coverage detected