-
Notifications
You must be signed in to change notification settings - Fork 777
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
support multi -extract-regex flag and json output #529
Conversation
Sorry, I don't know how to use git, so I've committed some of the content from the last pr to that pr. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm - A couple of suggestions:
- Remove duplicates from the extraction list + eventually replace them with a repetition counter:
{"head":["head","head"],"test":["test","test"]}
would become{"head":["head":2],"test":["test":2]}
- Add support for named extraction groups in regexes
^ @ehsandeep
I think the duplicate counters will be nested in one more layer, and can just be de-duplicated instead of adding counters. So, maybe we can just do the de-duplication. Named extraction groups seems to add new flag, I think, maybe add some extract regexp preset, like automatically map |
I tried to use FindAllStringSubMatch instead of FindAllString to get all named extraction groups in regexes, but it makes the result complicated and confusing. |
new feature support regexp preset dd5657e input: output: |
deduplicate results c56abcb input: new output: |
feature1: multiple -er flags
example :
echo https://www.baidu.com |.\httpx.exe -er head -er ip -silent
https://www.baidu.com [head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head,head] [ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip]
feature2: json output
example:
echo https://www.baidu.com |.\httpx.exe -er head -er ip -silent -json
{"timestamp":"2022-02-26T02:48:09.7169724+08:00","scheme":"https","port":"443","path":"/","body-sha256":"b90a16e9a86a118c71046ca27860e4023773fba3220fb742166d222ec664d6fa","header-sha256":"4ab7f2a738c21d43ba8a701e2efc94595e4b8a8b84e89f5168013af6bf2f90c7","url":"https://www.baidu.com:443","input":"https://www.baidu.com","title":"百度一下","webserver":"apache","content-type":"text/html","method":"GET","host":"45.113.192.101","content-length":206085,"status-code":200,"response-time":"2.4769607s","failed":false,"extracts":{"head":["head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head","head"],"ip":["ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip","ip"]},"lines":3,"words":3996}