Implemented proxy spec and useragent spoofing

This commit is contained in:
Luxferre
2024-10-22 20:11:33 +03:00
parent 20b522d18d
commit 4453ed575a
4 changed files with 54 additions and 11 deletions
+18 -10
View File
@@ -57,19 +57,27 @@ set appdir [file dirname $scriptpath]
if [string match *app-tiipost $appdir] {
set appdir [file normalize [file join $appdir ".." ".." ".." ]]
}
# auth string mapping
# populate general HTTP configuration
set cfgfile [file join $appdir "config.txt"]
if {[file exists $cfgfile]} {
set cfg [readfile $cfgfile]
if {[dict exists $cfg useragent]} {
::http::config -useragent [dict get $cfg useragent]
}
if {[dict exists $cfg proxyhost]} {
::http::config -proxyhost [dict get $cfg proxyhost]
}
if {[dict exists $cfg proxyport]} {
::http::config -proxyport [dict get $cfg proxyport]
}
}
# get auth string mapping
set authmap ""
set authfile [file join $appdir "auth.txt"]
if {[file exists $authfile]} {
set authdata [readfile $authfile]
set authlist [split $authdata "\n"]
foreach authline $authlist {
set authline [string trim $authline]
if {$authline ne ""} {
set parts [split $authline " \t"]
dict set authmap [string trim [lindex $parts 0]] [string trim [lindex $parts 1]]
}
}
set authmap [readfile $authfile]
}
if {$argc > 3} {