@@ -822,8 +822,8 @@ func joinURL(base string, path string) string {
822822 return base + path
823823}
824824
825- // requester is the main function that runs all the tests .
826- func requester (uri string , proxy string , userAgent string , reqHeaders []string , bypassIP string , folder string , method string , verbose bool , techniques []string , banner bool , rateLimit bool , timeout int , redirect bool , randomAgent bool ) {
825+ // setupRequestOptions configures and returns RequestOptions based on the provided parameters .
826+ func setupRequestOptions (uri , proxy , userAgent string , reqHeaders []string , bypassIP , folder , method string , verbose bool , techniques []string , banner , rateLimit bool , timeout int , redirect , randomAgent bool ) RequestOptions {
827827 // Set up proxy if provided.
828828 if len (proxy ) != 0 {
829829 if ! strings .Contains (proxy , "http" ) {
@@ -850,7 +850,7 @@ func requester(uri string, proxy string, userAgent string, reqHeaders []string,
850850 line , err := randomLine (folder + "/useragents" )
851851 if err != nil {
852852 fmt .Println ("Error reading the file:" , err )
853- return
853+ return RequestOptions {}
854854 }
855855 userAgent = line
856856 }
@@ -872,9 +872,7 @@ func requester(uri string, proxy string, userAgent string, reqHeaders []string,
872872 }
873873 }
874874
875- _verbose = verbose
876-
877- options := RequestOptions {
875+ return RequestOptions {
878876 uri : uri ,
879877 headers : headers ,
880878 method : method ,
@@ -891,8 +889,10 @@ func requester(uri string, proxy string, userAgent string, reqHeaders []string,
891889 banner : banner ,
892890 autocalibrate : ! verbose ,
893891 }
892+ }
894893
895- // Reset uniqueResults map before starting new requests
894+ // resetMaps clears all result tracking maps before starting new requests.
895+ func resetMaps () {
896896 shownResultsMutex .Lock ()
897897 for k := range shownResults {
898898 delete (shownResults , k )
@@ -910,22 +910,11 @@ func requester(uri string, proxy string, userAgent string, reqHeaders []string,
910910 delete (uniqueResultsByTechnique , k )
911911 }
912912 uniqueResultsByTechMutex .Unlock ()
913+ }
913914
914- if maxGoroutines > 100 {
915- log .Printf ("Warning: High number of goroutines (%d) may cause resource exhaustion." , maxGoroutines )
916- }
917-
918- // Call each function that will send HTTP requests with different variations of headers and URLs.
919- showInfo (options )
920-
921- // Auto-calibrate
922- if options .autocalibrate {
923- defaultCl = runAutocalibrate (options )
924- }
925-
926- requestDefault (options )
927-
928- for _ , tech := range techniques {
915+ // executeTechniques runs the selected bypass techniques based on the provided options.
916+ func executeTechniques (options RequestOptions ) {
917+ for _ , tech := range options .techniques {
929918 switch tech {
930919 case "verbs" :
931920 requestMethods (options )
@@ -949,3 +938,27 @@ func requester(uri string, proxy string, userAgent string, reqHeaders []string,
949938 }
950939 }
951940}
941+
942+ // requester is the main function that runs all the tests.
943+ func requester (uri string , proxy string , userAgent string , reqHeaders []string , bypassIP string , folder string , method string , verbose bool , techniques []string , banner bool , rateLimit bool , timeout int , redirect bool , randomAgent bool ) {
944+ _verbose = verbose
945+
946+ options := setupRequestOptions (uri , proxy , userAgent , reqHeaders , bypassIP , folder , method , verbose , techniques , banner , rateLimit , timeout , redirect , randomAgent )
947+
948+ resetMaps ()
949+
950+ if maxGoroutines > 100 {
951+ log .Printf ("Warning: High number of goroutines (%d) may cause resource exhaustion." , maxGoroutines )
952+ }
953+
954+ // Display configuration and perform auto-calibration
955+ showInfo (options )
956+
957+ // Auto-calibrate
958+ if options .autocalibrate {
959+ defaultCl = runAutocalibrate (options )
960+ }
961+
962+ requestDefault (options )
963+ executeTechniques (options )
964+ }
0 commit comments