forked from r4sas/PBinCLI
R4SAS
7 years ago
4 changed files with 24 additions and 25 deletions
@ -1,35 +1,28 @@ |
|||||||
import requests |
import requests |
||||||
import pbincli.settings |
import pbincli.settings |
||||||
|
|
||||||
class privatebin(object): |
class PrivateBin: |
||||||
def __init__(self): |
def __init__(self, server = pbincli.settings.server, proxy = pbincli.settings.proxy, useproxy = pbincli.settings.useproxy): |
||||||
if args.server: |
self.server = server |
||||||
self.server = args.server |
|
||||||
else: |
|
||||||
self.server = pbincli.settings.server |
|
||||||
|
|
||||||
self.headers = {'X-Requested-With': 'JSONHttpRequest'} |
self.headers = {'X-Requested-With': 'JSONHttpRequest'} |
||||||
|
if useproxy: |
||||||
if args.proxy: |
self.proxy = {proxy.split('://')[0]: proxy} |
||||||
self.proxies = {args.proxy.split('://')[0]: args.proxy} |
|
||||||
elif pbincli.settings.useproxy: |
|
||||||
self.proxies = pbincli.settings.proxies |
|
||||||
else: |
else: |
||||||
self.proxies = {} |
self.proxy = {} |
||||||
|
|
||||||
|
|
||||||
def post(self, request): |
def post(self, request): |
||||||
r = requests.post(url = self.server, headers = self.headers, proxies = self.proxies, data = request) |
r = requests.post(url = self.server, headers = self.headers, proxies = self.proxy, data = request) |
||||||
return r.text |
return r.text |
||||||
|
|
||||||
|
|
||||||
def get(self, request): |
def get(self, request): |
||||||
url = self.server + "?" + request |
url = self.server + "?" + request |
||||||
r = requests.get(url = url, headers = self.headers, proxies = self.proxies) |
r = requests.get(url = url, headers = self.headers, proxies = self.proxy) |
||||||
return r.text |
return r.text |
||||||
|
|
||||||
|
|
||||||
def delete(self, pasteid, token): |
def delete(self, pasteid, token): |
||||||
request = {'pasteid':pasteid,'deletetoken':token} |
request = {'pasteid':pasteid,'deletetoken':token} |
||||||
r = requests.post(url = self.server, headers = self.headers, proxies = self.proxies, data = request) |
r = requests.post(url = self.server, headers = self.headers, proxies = self.proxy, data = request) |
||||||
return r.text |
return r.text |
||||||
|
Loading…
Reference in new issue