go tcp使用

简介: TCP clientThere have been countless times during penetration tests that I've neededto whip up a TCP client to test for services, send garbage data, fuzz, orany number of other tasks.

TCP client
There have been countless times during penetration tests that I've needed
to whip up a TCP client to test for services, send garbage data, fuzz, or
any number of other tasks. If you are working within the confines of large
enterprise environments, you won't have the luxury of networking tools or
compilers, and sometimes you'll even be missing the absolute basics like the
ability to copy/paste or an Internet connection. This is where being able to
quickly create a TCP client comes in extremely handy. But enough jabbering

-blackhat python

确实很多时候http不一定合适,需要直接用tcp来进行测试,

这里是一个简单的示例

 

package main

import (
"net"
"fmt"
)

var (
target_host = "127.0.0.1"
target_port = 80
)

func main() {
c, _ := net.Dial("tcp", fmt.Sprintf("%s:%d", target_host, target_port))
buf := make([]byte, 4096)
c.Write([]byte("GET / HTTP/1.1\r\n\r\n"))
n,_:=c.Read(buf)
fmt.Println(string(buf[:n]))
}

 

目录
相关文章
|
网络协议 Go
Swoole与Go系列教程之TCP服务的应用
TCP(传输控制协议)的出现是为了解决计算机网络中的数据可靠传输和连接管理的问题。在早期的计算机网络中,特别是在分组交换和互联网的发展初期,网络是不可靠的,存在丢包、错误和延迟等问题。
1117 0
Swoole与Go系列教程之TCP服务的应用
|
网络协议 Go
【go笔记】TCP编程
【go笔记】TCP编程
|
网络协议 程序员 Go
GO语言使用之网络编程(TCP编程)
GO语言使用之网络编程(TCP编程)
202 0
|
网络协议 Linux Go
Go语言TCP Socket编程(下)
Go语言TCP Socket编程
174 1
|
网络协议 Go
GO语言学习 - 创建TCP监听
GO语言学习 - 创建TCP监听
313 32
|
网络协议 Ubuntu Unix
Go语言TCP Socket编程(上)
Go语言TCP Socket编程
280 0
|
网络协议 Go
go实现tcp网络编程
go实现tcp网络编程
249 0
go实现tcp网络编程
|
存储 网络协议 算法
一文搞懂Go语言网络编程【tcp、udp】
一文搞懂Go语言网络编程【tcp、udp】
一文搞懂Go语言网络编程【tcp、udp】
|
网络协议 Go
【GO】TCP交替通信
【GO】TCP交替通信
117 0
【GO】TCP交替通信
|
网络协议 Go
【GO】简单通信之TCP
【GO】简单通信之TCP
133 0
【GO】简单通信之TCP