1
1
mirror of https://github.com/r4sas/PBinCLI synced 2025-01-25 05:54:42 +00:00
PBinCLI/pbincli/transports.py

28 lines
812 B
Python
Raw Normal View History

2017-02-19 13:26:22 +03:00
import requests
2017-02-20 20:56:37 +03:00
#import urllib
2017-02-19 13:26:22 +03:00
2017-02-20 20:56:37 +03:00
class privatebin(object):
2017-02-20 15:13:42 +03:00
2017-02-19 13:26:22 +03:00
def __init__(self):
2017-02-20 15:13:42 +03:00
self.proxies = {'http': 'http://127.0.0.1:4444'}
2017-02-19 13:26:22 +03:00
self.server = 'http://paste.r4sas.i2p/'
self.headers = {'X-Requested-With': 'JSONHttpRequest'}
2017-02-20 15:13:42 +03:00
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
2017-02-20 20:56:37 +03:00
def delete(self, pasteid, token):
request = {'pasteid':pasteid,'deletetoken':token}
2017-02-20 15:13:42 +03:00
r = requests.post(url=self.server, headers=self.headers, proxies=self.proxies, data=request)
return r.text