mirror of https://github.com/r4sas/PBinCLI
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
961 B
29 lines
961 B
8 years ago
|
import requests
|
||
8 years ago
|
import pbincli.settings
|
||
8 years ago
|
|
||
7 years ago
|
class PrivateBin:
|
||
|
def __init__(self, server = pbincli.settings.server, proxy = pbincli.settings.proxy, useproxy = pbincli.settings.useproxy):
|
||
|
self.server = server
|
||
8 years ago
|
self.headers = {'X-Requested-With': 'JSONHttpRequest'}
|
||
7 years ago
|
if useproxy:
|
||
|
self.proxy = {proxy.split('://')[0]: proxy}
|
||
7 years ago
|
else:
|
||
7 years ago
|
self.proxy = {}
|
||
8 years ago
|
|
||
7 years ago
|
|
||
8 years ago
|
def post(self, request):
|
||
7 years ago
|
r = requests.post(url = self.server, headers = self.headers, proxies = self.proxy, data = request)
|
||
8 years ago
|
return r.text
|
||
8 years ago
|
|
||
|
|
||
|
def get(self, request):
|
||
|
url = self.server + "?" + request
|
||
7 years ago
|
r = requests.get(url = url, headers = self.headers, proxies = self.proxy)
|
||
8 years ago
|
return r.text
|
||
|
|
||
|
|
||
8 years ago
|
def delete(self, pasteid, token):
|
||
|
request = {'pasteid':pasteid,'deletetoken':token}
|
||
7 years ago
|
r = requests.post(url = self.server, headers = self.headers, proxies = self.proxy, data = request)
|
||
8 years ago
|
return r.text
|