したらばTOP ■掲示板に戻る■ 全部 1-100 最新50 | |
レス数が1スレッドの最大レス数(1000件)を超えています。残念ながら投稿することができません。

B11 と readcgi.js のスレ#2 @避難所

51名無しさん@避難所:2017/09/03(日) 18:18:09 ID:V9hFwVUE0
自動でUAを変えるローカル串
localhost:8080に設定すれば使える


package main

import (
"crypto/md5"
"encoding/hex"
"fmt"
"io/ioutil"
"log"
"net/http"
"time"

"github.com/elazarl/goproxy"
)

func main() {
proxy := goproxy.NewProxyHttpServer()
proxy.Verbose = true
proxy.OnRequest().DoFunc(
func(r *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response) {
res, _ := http.Get("http://ipcheck.mycurse.net/")
defer res.Body.Close()
byteArray, _ := ioutil.ReadAll(res.Body)
ip := string(byteArray)
now := time.Now()
hasher := md5.New()
hasher.Write([]byte(fmt.Sprintln(ip, r.Host, now.Year(), now.Month(), now.Day())))
hash := hex.EncodeToString(hasher.Sum(nil))
r.Header.Set("User-Agent", "Monazilla/1.00 ("+hash+"/1)")

return r, nil
})

log.Fatal(http.ListenAndServe(":8080", proxy))
}




掲示板管理者へ連絡 無料レンタル掲示板