Last active
May 1, 2026 02:03
-
-
Save ishideo/8c5f3cfcd4a29116e641195817161357 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| cat cert.tsv | bb -e ' | |
| (->> (slurp *in*) | |
| str/split-lines | |
| (mapcat #(re-seq #"\\n\s\sCommonName:\s.*?\\n\\n|\\nDNS Names:\\n.*?\\n\\n" %)))' \ | |
| | bb -e ' | |
| (->> (slurp *in*) | |
| str/split-lines | |
| (mapcat #(str/split % #"\\\\n")) | |
| (filter #(re-find #"CommonName:|^\s+[\w\*]" %)) | |
| (map #(-> % str/trim (str/replace #".*CommonName:\s+" ""))) | |
| (remove str/blank?) | |
| (run! println)) | |
| ' > domains_fofa.tsv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| cat cert.tsv | bb -e ' | |
| (->> (slurp *in*) | |
| str/split-lines | |
| (mapcat #(re-seq #"^Subject:\\n\s\sCommon Name:\s\s\s\s\s\s\s\s\s\s.*?\\n|DNS:.*?\\n|DNS:.*?\\n\\n" %)))' \ | |
| | bb -e ' | |
| (->> (slurp *in*) | |
| str/split-lines | |
| (mapcat #(str/split % #"\\\\n")) | |
| (filter #(re-find #"Common Name:|DNS:|^\s+[\w\*]" %)) | |
| (map #(-> % str/trim (str/replace #".*Common Name:\s\s\s\s\s\s\s\s\s\s" ""))) | |
| (map #(-> % str/trim (str/replace #".*DNS:\s" ""))) | |
| (remove str/blank?) | |
| (run! println)) | |
| ' > domains_hunterhow.tsv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| cat cert.tsv | bb -e ' | |
| (->> (slurp *in*) | |
| str/split-lines | |
| (mapcat #(re-seq #"CN=[^,/\\]+|DNS:\s*[^,\s]+" %)) | |
| (map #(-> % (str/replace #"^.*CN=" "") (str/replace #"^.*DNS:\s*" "") str/trim)) | |
| (map #(-> % str/trim (str/replace #"\\n$" ""))) | |
| (remove str/blank?) | |
| distinct | |
| (sort-by str/lower-case) | |
| (run! println)) | |
| ' > domains_zoomeye.tsv |
Author
#!/usr/bin/env bash
cat cert.tsv | bb -e '
(let [normalize #(str/replace % #"^\*\." "")
tokens (str/split (slurp *in*) #"\\n")]
(loop [[x & xs] tokens
mode nil
out []]
(if (nil? x)
(run! println out)
(let [t (str/trim x)]
(cond
(= t "Subject:") (recur xs :subject out)
(= t "DNS Names:") (recur xs :dns out)
(and (= mode :subject) (str/starts-with? t "CommonName: "))
(recur xs nil (conj out (normalize (subs t 12))))
(and (= mode :dns) (not (str/blank? t)) (not (str/ends-with? t ":")))
(recur xs :dns (conj out (normalize t)))
:else
(recur xs nil out))))))
' > domains_fofa.tsv
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.