├── Dockerfile ├── Paramx.jl ├── README.md ├── src ├── arg.jl ├── func.jl ├── html_tags.txt └── paramx.png └── test ├── all_tests.jl ├── file_names_test.jl ├── js_params_test.jl ├── php_params_test.jl ├── xml_params_test.jl ├── zfile_html1.html ├── zfile_js1.js ├── zfile_php1.php └── zfile_xml1.xml /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM julia:1.11.4 2 | RUN julia -e 'using Pkg; Pkg.add(["JSON", "ArgParse", "OrderedCollections", "Cascadia", "Gumbo", "HTTP"])' 3 | RUN mkdir /Paramx 4 | WORKDIR /Paramx/ 5 | COPY . /Paramx/ 6 | ENTRYPOINT [ "julia", "/Paramx/Paramx.jl" ] 7 | CMD [ "-h" ] -------------------------------------------------------------------------------- /Paramx.jl: -------------------------------------------------------------------------------- 1 | using Pkg 2 | 3 | function ensure_package() 4 | dependencies = ("OrderedCollections",) 5 | 6 | for pkg in dependencies 7 | isnothing(Base.find_package(pkg)) && Pkg.add(pkg) 8 | end 9 | end 10 | ensure_package() 11 | 12 | include("src/func.jl") 13 | include("src/arg.jl") 14 | 15 | 16 | # user passed cli arguments 17 | const args = ARGUMENTS() 18 | 19 | function process_html(source::String)::Vector{String} 20 | res = String[] 21 | args["a"] && append!(res, extract_a_tags(source)) 22 | args["i"] && append!(res, extract_input_tags(source)) 23 | args["s"] && append!(res, extract_script_tags(source)) 24 | args["w"] && append!(res, extract_url(source)) 25 | args["f"] && append!(res, extract_file_name(source, args["e"])) 26 | return res 27 | end 28 | 29 | function process_js(source::String)::Vector{String} 30 | res = String[] 31 | source = "
\n\n" 32 | args["p"] && append!(res, extract_script_tags(source)) 33 | args["w"] && append!(res, extract_url(source)) 34 | args["f"] && append!(res, extract_file_name(source, args["e"])) 35 | return res 36 | end 37 | 38 | function process_php(source::String)::Vector{String} 39 | res = String[] 40 | args["p"] && append!(res, extract_php_params(source)) 41 | args["w"] && append!(res, extract_url(source)) 42 | args["f"] && append!(res, extract_file_name(source, args["e"])) 43 | return res 44 | end 45 | 46 | function process_xml(source::String)::Vector{String} 47 | res = String[] 48 | args["p"] && append!(res, extract_xml_elemnts(source)) 49 | args["w"] && append!(res, extract_url(source)) 50 | args["f"] && append!(res, extract_file_name(source, args["e"])) 51 | return res 52 | end 53 | 54 | function process_req(source::String)::Vector{String} 55 | res = String[] 56 | args["p"] && append!(res, extract_script_tags(source), extract_input_tags(source)) 57 | args["w"] && append!(res, extract_url(source)) 58 | args["f"] && append!(res, extract_file_name(source, args["e"])) 59 | return res 60 | end 61 | 62 | function process_resp(source::String)::Vector{String} 63 | res = String[] 64 | args["p"] && append!(res, extract_script_tags(source), extract_input_tags(source)) 65 | args["w"] && append!(res, extract_url(source)) 66 | args["f"] && append!(res, extract_file_name(source, args["e"])) 67 | return res 68 | end 69 | 70 | function process_url(urls::Vector{String}) 71 | 72 | end 73 | 74 | 75 | function main() 76 | result = String[] 77 | 78 | if !isempty(args["source"]) 79 | Threads.@threads for url in args["source"] 80 | try 81 | source = SendHttpRequest(url, args["X"], args["H"], args["timeout"]) 82 | if args["ft"] == "html" 83 | append!(result, process_html(source)) 84 | elseif args["ft"] == "js" 85 | append!(result, process_js(source)) 86 | elseif args["ft"] == "php" 87 | append!(result, process_php(source)) 88 | elseif args["ft"] == "xml" 89 | append!(result, process_xml(source)) 90 | end 91 | catch e 92 | msg = styled"""Error processing URL: {error:$(url)} -> 💢 {error:dropped}""" 93 | @error msg 94 | continue 95 | end 96 | end 97 | end 98 | 99 | if !isempty(args["html"]) 100 | source = ReadFile(args["html"]) 101 | append!(result, process_html(source)) 102 | end 103 | 104 | if !isempty(args["js"]) 105 | source = ReadFile(args["js"]) 106 | append!(result, process_js(source)) 107 | end 108 | 109 | if !isempty(args["php"]) 110 | source = ReadFile(args["php"]) 111 | append!(result, process_php(source)) 112 | end 113 | 114 | if !isempty(args["xml"]) 115 | source = ReadFile(args["xml"]) 116 | append!(result, process_xml(source)) 117 | end 118 | 119 | if !isempty(args["req"]) 120 | source = ReadFile(args["req"]) 121 | append!(result, process_req(source)) 122 | end 123 | 124 | if !isempty(args["resp"]) 125 | source = ReadFile(args["resp"]) 126 | append!(result, process_resp(source)) 127 | end 128 | 129 | if !isempty(args["o"]) 130 | WriteFile(args["o"], "w+", join(unique(result), "\n")) 131 | @info "data saved in file: $(args["o"])" 132 | else 133 | printstyled(join(unique(result), "\n"), "\n", bold = true, color = :light_green) 134 | end 135 | end 136 | 137 | main() 138 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |