Implemented proxy spec and useragent spoofing
This commit is contained in:
+18
-10
@@ -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} {
|
||||
|
||||
Reference in New Issue
Block a user