mirror of https://github.com/r4sas/PBinCLI
R4SAS
8 years ago
5 changed files with 110 additions and 24 deletions
@ -1,19 +1,26 @@
@@ -1,19 +1,26 @@
|
||||
import requests |
||||
import json |
||||
import urllib |
||||
from pprint import pprint |
||||
class privatebin(object): |
||||
|
||||
|
||||
def __init__(self): |
||||
#self.proxies = {'http': 'http://127.0.0.1:4444'} |
||||
self.proxies = {'http': 'http://127.0.0.1:4444'} |
||||
self.server = 'http://paste.r4sas.i2p/' |
||||
self.headers = {'X-Requested-With': 'JSONHttpRequest'} |
||||
|
||||
def post(self, data, password): |
||||
#r = requests.post(url=self.server, headers=self.headers, proxies=self.proxies, data=data) |
||||
r = requests.post(url=self.server, headers=self.headers, data=data) |
||||
print(r.text) |
||||
result = json.loads(r.text) |
||||
'''Standart response: {"status":0,"id":"aaabbb","url":"\/?aaabbb","deletetoken":"aaabbbccc"}''' |
||||
if result['status'] == 0: |
||||
print("Paste uploaded!\nPasteID:\t{}\nPassword:\t{}\nDelete token:\t{}\n".format(result['id'], password.decode("UTF-8"), result['deletetoken'])) |
||||
|
||||
def post(self, request): |
||||
r = requests.post(url=self.server, headers=self.headers, proxies=self.proxies, data=request) |
||||
return r.text, self.server |
||||
|
||||
|
||||
def get(self, request): |
||||
url = self.server + "?" + request |
||||
r = requests.get(url=url, headers=self.headers, proxies=self.proxies) |
||||
return r.text |
||||
|
||||
|
||||
def delete(self, request): |
||||
r = requests.post(url=self.server, headers=self.headers, proxies=self.proxies, data=request) |
||||
return r.text |
||||
|
Loading…
Reference in new issue