Coder Social home page Coder Social logo

i-was-a-fish / hackrequests Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brianwrf/hackrequests

0.0 1.0 0.0 14 KB

It is a dedicated requests lib that supports cookie, headers, get/post, etc. And it also supports rendering the response (e.g. Javascript, CSS, etc.) of GET requests by using PhantomJs enginee.

Python 100.00%

hackrequests's Introduction

HackRequests:

It is a dedicated requests lib that supports cookie, headers, get/post, etc. And it also supports rendering the response (e.g. Javascript, CSS, etc.) of GET requests by using PhantomJs enginee.

Requirements:

Install Selenium:

  • sudo pip install -U selenium
  • sudo apt-get install libfontconfig

Install PhantomJs:

Configuration:

Modify self.executable_path to the path of PhantomJS binary, e.g. self.executable_path='/home/ubuntu/phantomjs-2.1.1-linux-x86_64/bin/phantomjs'

Usage:

import requests
import re
import time
from hack_requests import HackRequests

request_info = {} # It is a dict which contains all HTTP headers and data, the format is similar as Burp request.
request_info['protocol'] = 'http'
request_info['host'] = 'example.com'
request_info['path'] = '/iam/the/url?para=PARA'
request_info['user_agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Firefox/45.0'
request_info['accept'] = '*/*'
request_info['accept_language'] = 'en-US,en;q=0.5'
request_info['accept_encoding'] = 'gzip, deflate'
request_info['referer'] = "http://example.com/"
request_info['cookie'] = "PHPSESSID=look_at_me_i_am_the_sessionid; Second_Cookie=i_am_second_cookie"
request_info['post_data'] = "para1=PARA1&para2=PARA2"

# Send GET request by using PhantomJS
r_get_p = HackRequests(request_info, 'PHANTOMJS').get_request() 

# Send GET request by using Requests
r_get_r = HackRequests(request_info).get_request()

# Send POST request by using Requests
r_post_r = HackRequests(request_info).post_request()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.