funURL is a command-line tool designed as a Swiss Army knife for URLs. It takes a URL as input (via stdin, command-line flags, or arguments) and provides a range of operations for parsing, validation, modification, encoding/decoding, and handling URLs efficiently.
- Golang 1.18+
funURL
requires go1.18+ to install successfully. Run the following command to get the repo:
go install -v github.com/HappyHackingSpace/funURL/cmd/funurl@main
Extract specific components from a URL:
# Parse all URL components
funURL parse https://subdomain.vulnerabletarget.com/path?query=value#fragment
# Extract specific components
funURL parse -c https://vulnerabletarget.com # Extract protocol/scheme
funURL parse -s https://subdomain.vulnerabletarget.com # Extract subdomain
funURL parse -t https://vulnerabletarget.com # Extract top-level domain
funURL parse -n https://vulnerabletarget.com # Extract hostname
funURL parse -p https://vulnerabletarget.com/path # Extract path
funURL parse -q https://vulnerabletarget.com/?key=value # Extract query parameters
funURL parse -f https://vulnerabletarget.com/#section # Extract fragments
Add, remove, or update URL components:
# Change protocol
funURL modify -c https http://vulnerabletarget.com
# Update path
funURL modify -p /new/path https://vulnerabletarget.com/old/path
# Change query string
funURL modify -q "key1=value1&key2=value2" https://vulnerabletarget.com?old=param
# Update fragment
funURL modify -f "new-section" https://vulnerabletarget.com#old-section
Encode URLs or URL components:
# Path-encode a URL
funURL encode "hello world"
# Query component encoding
funURL encode -c "param=value with spaces"
Decode URLs or URL components:
# Path-decode a URL
funURL decode "hello%20world"
# Query component decoding
funURL decode -c "param%3Dvalue%20with%20spaces"
funURL dedupe https://google.com https://google.com/home?qs=value https://google.com/home?qs=secondValue https://google.com/home?qs=newValue&secondQs=anotherValue https://google.com/home?qs=asd&secondQs=das https://site.com/api/users/123 https://site.com/api/users/222 https://site.com/api/users/412/profile https://site.com/users/photos/photo.jpg https://site.com/users/photos/myPhoto.jpg https://site.com/users/photos/photo.png https://google.com/home/?q=2&d=asd https://my.site/profile?param1=1¶m2=2 https://my.site/profile?param3=3
cat urls.txt | funURL dedupe
funURL supports multiple ways to provide input:
-
Via command-line argument:
funURL parse https://vulnerabletarget.com
-
Via the
--url
flag:funURL parse --url https://vulnerabletarget.com
-
Via standard input (pipe or interactive):
echo "https://vulnerabletarget.com" | funURL parse # Or funURL parse # Then type the URL and press Enter
# Parse a URL and extract all components
funURL parse https://user:pass@sub.vulnerabletarget.com:8080/path/to/page?query=string#fragment
# Encode a query parameter
funURL encode -c "search=special chars: &?=+"
# Decode a path component
funURL decode "my%20encoded%20path"
# Change protocol and path in one command
funURL modify -c https -p /new/path http://vulnerabletarget.com/old
Hack! don't forget to follow CONTRIBUTING