52 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
package wmi
 | 
						|
 | 
						|
//import (
 | 
						|
//	"fmt"
 | 
						|
//	"git.loafle.net/overflow/overflow_probe/collector/discovery/scan/matcher/packet"
 | 
						|
//	"git.loafle.net/overflow/overflow_probe/collector/discovery/scan/matcher/scaninfo"
 | 
						|
//	"git.loafle.net/overflow/overflow_probe/collector/discovery/types"
 | 
						|
//	"net"
 | 
						|
//	"testing"
 | 
						|
//)
 | 
						|
//
 | 
						|
//func TestWMI(t *testing.T) {
 | 
						|
//
 | 
						|
//	lm := NewWMIMatcher()
 | 
						|
//
 | 
						|
//	port := types.NewPort("135", types.NewHost("192.168.1.1"), types.TYPE_TCP)
 | 
						|
//	scanInfo := scaninfo.NewServiceScanInfo(port)
 | 
						|
//	var ipport string
 | 
						|
//	ipport = port.Host.Ip + ":" + string(port.Port)
 | 
						|
//
 | 
						|
//	fmt.Println(ipport)
 | 
						|
//	client, _ := net.Dial("tcp", ipport)
 | 
						|
//
 | 
						|
//	defer client.Close()
 | 
						|
//
 | 
						|
//	fmt.Println(lm.PacketCount())
 | 
						|
//
 | 
						|
//	for ii := 0; ii < lm.PacketCount(); ii++ {
 | 
						|
//
 | 
						|
//		pack := lm.Packet(ii)
 | 
						|
//
 | 
						|
//		fmt.Println(pack)
 | 
						|
//
 | 
						|
//		client.Write(pack.Buffer)
 | 
						|
//
 | 
						|
//		bytes := make([]byte, 1024)
 | 
						|
//
 | 
						|
//		read, _ := client.Read(bytes)
 | 
						|
//
 | 
						|
//		//fmt.Println(bytes)
 | 
						|
//
 | 
						|
//		b := lm.Match(ii, packet.NewPacket(bytes, read), scanInfo)
 | 
						|
//
 | 
						|
//		if b {
 | 
						|
//			fmt.Println("Good")
 | 
						|
//		}
 | 
						|
//
 | 
						|
//	}
 | 
						|
//
 | 
						|
//	t.Log(scanInfo)
 | 
						|
//}
 |