Skip to main content

What is Rapic ?

Rapic is a simple and fast lightweight tool for automatically generating api client libraries and sdk for websites and online services. It also support automatic generation of client libraries for 3rd party public and private api's which is very good for reverse engineers.

Installation

pip install rapic

Running

There are 2 ways to use rapic

  • Using rapic-client-generator to automatically generate client file from a reverse engineering tool.
  • Manually creating rapic api client file.

Using Rapic Client Generator

As a reverse engineer saving time is essential which means reducing time spent on writing api client for reversed private 3rd party api, website or other internet services. Rapic makes generating client libraries easy with just these few steps :

** NOTE** Rapic automatic client generator only support BURPSUITE reverse engineering tool currently

  • STEP 1 : While using BurpSuite Right click on a website under site map tab under target

  • STEP 2 : Save requests as xml file and untick base64 encode requests and response

  • STEP 3 : Run 'rapic-client-generator burp <website_site_or_api_name> saved_file.xml'

  • STEP 4 : Open generated json file and name your request then Use the client like

       from rapic.client import APIClient
       api = ApiClient(client_name='website_or_service_name', request_file=generated_file_from_rapic.json)
       val = api.get_currency() # A request is named get_currency by changing request_<num> to get_currency for a chosen request in json file
    

Using Rapic Client JSON files

Programmers can also save time when creating client libraries/sdk for their website and service using rapic. Simply by creating a json file with structure

***json_file.json  

            {
             "host": "httpbin.org",
              "scheme": "http",
                  "get_my_ip": {
                        "path": "/ip",
                        "method": "GET"
                    },
             }
                
                
 *** client.py
 
      from rapic.client import APIClient
      api = ApiClient(client_name='website_or_service_name', request_file=json_file.json)
      val = api.get_my_ip() 

NOTE : check test folder for more json file structure and supported keys

Request can also be hooked before its sent to server to do extra processing like http signature signing, timestamp generation etc.

    ***json_file.json 
    
            {
             "host": "httpbin.org",
              "scheme": "http",
                  "get_user_followers": {
                        "path": "/get_user_followers/{path_id}",
                        "method": "POST"
                    },
             }
     ***client.py
     
        import hashlib
        from rapic.client import APIClient
        from rapic.hook import APIClientHook
        
        class MyApiClient(APIClient):

            @APIClientHook.hook_client_request_data(client='httpbin',
                                                    requests=['get_user_followers'])
            def set_http_signature_on_header(data, **kwargs):
                sign_request = data['url'] + data['method'] + urlencode(data['body_data'])
                m = hashlib.sha256()
                m.update(bytes(sign_request, encoding='utf8'))
                signature = m.hexdigest()
                data['headers']['signature'] = signature
                self.http_signature = signature
                return data
        api = MyApiClient(client_name='website_or_service_name', request_file=json_file.json)
        val = api.get_user_followers(data={user_id : 67888}, url_data={path_id : 'unique_id_get_set_as_path_id'})

** List of hooks supported **

  • APIClientHook.hook_client_prepared_request()
  • APIClientHook.hook_client_response()
  • APIClientHook.hook_client_request_data()
  • APIClientHook.hook_client_body_data()
  • APIClientHook.hook_client_url()
  • APIClientHook.hook_client_header()

LICENSE

MIT

Metadata

Release files for rapic 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rapic 0.1.5
File Size Uploaded Provenance
rapic-0.1.5.tar.gz 17.5 kB Without provenance Details

Release files / rapic-0.1.5.tar.gz

Download URL rapic-0.1.5.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fff054261af69b24a55484b08717d9fd1319999c3bbd22ab448abbea889d43ca
BLAKE2b-256 checksum
How to use checksums
add45e663da92d0515b3b65a02e9f201a1f6225a57932bd1c4635560d10e8f9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.6.8

Security for rapic 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page