Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor + misc improvements #499

Merged
merged 14 commits into from
Feb 23, 2024
Merged

refactor + misc improvements #499

merged 14 commits into from
Feb 23, 2024

Conversation

tarunKoyalwar
Copy link
Member

@tarunKoyalwar tarunKoyalwar commented Feb 19, 2024

Proposed Changes

  • Fix/Add Support for http://proxify domain placeholder for downloading cert (this got removed when we switched to martian)
  • Enable Color Output By default ( earlier it was disabled)
  • Performance + Refactor (Use response chain + needed refactor)
  • Fix / Decode Response Body Encoding ( Gzip etc )
  • Updated Readme
  • Introduce New Output Format ( MultiDoc Yaml )
    • While JSONL is good but its difficult to view it in any editor due to strict json rules and escapes ( yaml multidoc is similar in terms of capabilities i.e can be streamed and read/written one after another without loading all data into memory at once)
timestamp: 2024-02-20T03:57:53+05:30
url: https://scanme.sh:443
request:
  header:
    Connection: close
    User-Agent: curl/8.1.2
    host: scanme.sh:443
    method: CONNECT
    path: ''
    scheme: https
  raw: |+
    CONNECT scanme.sh:443 HTTP/1.1
    Host: scanme.sh:443
    Connection: close
    User-Agent: curl/8.1.2

response:
  raw: |+
    HTTP/1.1 200 OK
    Content-Length: 0


---
timestamp: 2024-02-20T03:57:54+05:30
url: https://scanme.sh/
request:
  header:
    Accept: '*/*'
    Connection: close
    User-Agent: curl/8.1.2
    host: scanme.sh
    method: GET
    path: /
    scheme: https
  raw: |+
    GET / HTTP/1.1
    Host: scanme.sh
    Accept: */*
    Connection: close
    User-Agent: curl/8.1.2

response:
  header:
    Content-Length: '2'
    Content-Type: text/plain; charset=utf-8
    Date: Mon, 19 Feb 2024 22:27:54 GMT
  body: ok
  raw: |+
    HTTP/1.1 200 OK
    Connection: close
    Content-Length: 2
    Content-Type: text/plain; charset=utf-8
    Date: Mon, 19 Feb 2024 22:27:54 GMT

@tarunKoyalwar tarunKoyalwar self-assigned this Feb 19, 2024
@tarunKoyalwar tarunKoyalwar marked this pull request as ready for review February 19, 2024 20:43
@tarunKoyalwar tarunKoyalwar marked this pull request as draft February 19, 2024 21:08
@tarunKoyalwar
Copy link
Member Author

Implement req-fd & resp-fd logic to jsonl / yaml outputs

  • results of req-fd and resp-fd (can also have multiple values/conditions) are stacked with AND condition
  • if no filters are provided then all logs are written . if filters are provided and matched (true) then only those req+resp pairs are logged in output files (json,yaml)
  • negation operator ! can be used to write negative condition

Example

./proxify -of yaml -req-fd 'method != "CONNECT"' -resp-fd 'to_number(content_length) > 0' 

                       _ ___    
   ___  _______ __ __ (_) _/_ __
  / _ \/ __/ _ \\ \ // / _/ // /
 / .__/_/  \___/_\_\/_/_/ \_, / 
/_/                      /___/

		projectdiscovery.io

[INF] Current proxify version v0.0.13 (latest)
[INF] HTTP Proxy Listening on 127.0.0.1:8888
[INF] Saving proxify logs to proxify_logs.yaml

Here req+resp is only logged if resulting condition is true i.e AND condition of both
method != "CONNECT" && to_number(content_length) > 0
must be true

for debugging purposes print_debug can be used

./proxify -of yaml -req-fd 'method != "CONNECT"' -resp-fd 'print_debug(to_number(content_length) > 0)' 

@tarunKoyalwar tarunKoyalwar marked this pull request as ready for review February 19, 2024 21:56
@ehsandeep ehsandeep merged commit 3fb0424 into dev Feb 23, 2024
8 checks passed
@ehsandeep ehsandeep deleted the mulit-doc-yaml branch February 23, 2024 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants