http内网转发
package main import (
"io"
"log"
"net/http"
"strings"
) func main() {
localHost := "127.0.0.1.8001"
targetHost := "127.0.0.1:80"
httpsServer(localHost, targetHost) log.Fatalln("http server down!!!")
} func httpsServer(addr string, remote_addr string) { http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
cli := &http.Client{}
body := make([]byte, 0)
n, err := io.ReadFull(req.Body, body)
if err != nil {
io.WriteString(w, "Request Data Error")
return
}
reqUrl := "http://" + remote_addr + req.URL.Path req2, err := http.NewRequest(req.Method, reqUrl, strings.NewReader(string(body)))
if err != nil {
io.WriteString(w, "Request Error")
return
}
// set request content type
contentType := req.Header.Get("Content-Type")
req2.Header.Set("Content-Type", contentType)
// request
rep2, err := cli.Do(req2)
if err != nil {
io.WriteString(w, "Not Found!")
return
}
defer rep2.Body.Close()
n, err = io.ReadFull(rep2.Body, body)
if err != nil {
io.WriteString(w, "Request Error")
return
}
// set response header
for k, v := range rep2.Header {
w.Header().Set(k, v[0])
}
io.WriteString(w, string(body[:n]))
})
var err error = nil
err = http.ListenAndServe(":12307", nil)
if err != nil {
log.Fatal("server down!!!")
}
}
http内网转发的更多相关文章
- Tunna内网转发
Tunna和reduh原理一样.. 使用方法: 上传源码包中文件夹webshell下的脚本至网站目录 然后本地进行连接上传的webshell即可 python proxy.py -u http://1 ...
- Linux渗透+SSH内网转发
http://www.jb51.net/hack/58514.html http://blog.chinaunix.net/uid-756931-id-353243.html http://blog. ...
- lcx.exe内网转发命令教程 + LCX免杀下载
作者: 小健 本机: lcx -listen 2222 3333 2222为转发端口,3333为本机任意未被占用的端口 肉鸡:lcx -slave 119.75.217.56 2222 127.0.0 ...
- iptables 实现内网转发上网
介绍 通过iptables做nat转发实现所有内网服务器上网. 操作 首先开启可以上网的服务器上的内核路由转发功能.这里我们更改/etc/sysctl.conf 配置文件. [root@web1 /] ...
- lcx 内网转发
把放置到已经控制的内网主机 执行 内网主机输入命令lcx.exe -slave 外网ip 外网端口 内网ip 内网端口lcx.exe -slave 30.1.85.55 2222 127.0.0.1 ...
- 使用Sunny-grok实现内网转发
Sunny-grok 申请地址:http://www.ngrok.cc ngrok.cfg配置: server_addr: "server.ngrok.cc:4443" auth_ ...
- 内网转发ngrok的使用
1.下载解压ngrok:https://ngrok.com/download 2.执行ngrok会打开控制台 3.输入命令,开始映射本地的8080端口 ngork http 8080 控制台会返回一个 ...
- i春秋DMZ大型靶场实验(三)内网转发DMZ2
更具实验文件知道存在源码泄露 下载源码进行源码审计 发现admin账号 查看user.php 发现mysql 账号 端口 对登录后源码进行审计 发现上传文件的两处漏洞 对 fiel name 可以 ...
- 3.内网渗透之reGeorg+Proxifier
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAxIAAAE2CAIAAAB6BDOVAAAgAElEQVR4Aey9Z5Aex3X327MRGVzkRH ...
随机推荐
- php字符串查找函数 php查找字符串中出现的次数函数substr_count,判断字符串中是否包含另一个字符串函数strpos
php字符串查找函数 php查找字符串中出现的次数函数substr_count,判断字符串中是否包含另一个字符串函数strpossubstr_count($haystack, $needle [,$o ...
- LeeCode——Combine Two Tables
Table: Person +-------------+---------+ | Column Name | Type | +-------------+---------+ | PersonId ...
- 简单使用:SpringBoot整合Redis
1.导入依赖: <dependency> <groupId>org.springframework.boot</groupId> <artifactId> ...
- K8s容器编排
K8s容器编排 Kubernetes(k8s)具有完备的集群管理能力: 包括多层次的安全防护和准入机制 多租户应用支撑能力 透明的服务注册和服务发现机制 内建智能负载均衡器 强大的故障发现和自我修复能 ...
- mysql_innodb存储引擎的优化
采用innodb作为存储引擎时的优化 innodb_buffer_pool_size 如果用 Innodb,那么这是一个重要变量.相对于 MyISAM 来说,Innodb对于 buffer size ...
- ArrayList对象声明& arrayList.size()
此程序用于测试 :每次for循环内重新定义一个Integer数组,赋值后加入arrayList.由于下一次的Integer对象重新定义,原来的对象是否会被释放? 解答:不会,因为原对象仍被引用(被ar ...
- 使用ruamel.yaml库,解析yaml文件
在实现的需求如下: 同事提供了一个文本文件,内含200多个host与ip的对应关系,希望能在k8s生成pod时,将这些对应关系注入到/etc/hosts中. 网上看文档,这可以通过扩充pod中的hos ...
- Nacos 知识点
Nacos 名字的由来(取红色的英文字符): Dynamic Naming and Configuration Service Nacos 是 Spring Cloud Alibaba 的一个组件,详 ...
- webpy安装
C:\Users\ceshi>python -m pip install web.pyCollecting web.py Downloading web.py-0.38.tar.gz (91kB ...
- pikachu SQL-Injection
1.数字型注入(POST) 可以看到,这个参数提交是POST类型的,用burp. 测试参数id id='&submit=%E6%9F%A5%E8%AF%A2 可以看到有报错回显,而且根据回显可 ...