// File: /workspace/github_cpp_makefile_star2_O3/JohnWoodman[P]SHellNo/main.cpp
// Function: main
int main() 
{ 
	string buff;
	while(true){
		cout<<"ShellNo->";
		getline(cin,buff);
		// 49152-65535
		regex param("list -c ([1-5]?[0-9]?[0-9]?[0-9]?[0-9]|[6][0-5][0-5][0-3][0-5])");
		if(regex_match(buff,param)){
			smatch match;
			regex numb("[1-5]?[0-9]?[0-9]?[0-9]?[0-9]|[6][0-5][0-5][0-3][0-5]");
			regex_search(buff,match,numb);
			int port = stoi(match[0],nullptr,10);
			listManager->addListener(port);
			//t1.join();
		}
		if(regex_match(buff,regex("list -a"))){
			listManager->listListeners();
		}
		if(regex_match(buff,regex("list -l [1-9]?[1-9]"))){
			smatch match;
			regex numb("[1-9]?[1-9]");
			regex_search(buff,match,numb);
			int id = stoi(match[0],nullptr,10);
			postExploitMenu(listManager->getListener(id-1));
		}
		if (regex_match(buff, regex("exit"))) {
			break;
		}
		if(regex_match(buff, regex("help"))){
			printf("HELP MENU\n");
			printf("<========>\n");
			printf("list -c <port number>: listen on port\n");
			printf("list -a: list all listeners\n");
			printf("list -l <id>: connect to specific listener\n");
			printf("exit: exit ShellNo\n");
		}

	}

	return 0; 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
leaq -0x80(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x194ae(%rip), %rbx     # 0x1efd8
leaq -0xd8(%rbp), %r14
leaq -0x50(%rbp), %r15
leaq -0xb8(%rbp), %r12
movl $0x9, %edx
movq 0x19460(%rip), %rdi     # 0x1efa8
leaq 0x105a9(%rip), %rsi     # 0x160f8
callq 0x5400
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5350
movsbl %al, %edx
movq %rbx, %rdi
leaq -0x90(%rbp), %rsi
callq 0x5680
movq %r14, %rdi
leaq 0x1057e(%rip), %rsi     # 0x16102
movl $0x10, %edx
callq 0x61b8
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
addq %rdi, %rsi
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
movq %r15, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x11b78
movl %eax, %ebx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x5bcf
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x5370
testb %bl, %bl
je 0x5d26
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
movq %r12, %rdi
leaq 0x10556(%rip), %rsi     # 0x16142
movl $0x10, %edx
callq 0x61b8
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
addq %rdi, %rsi
movq %r15, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0x13d07
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rdx
movq %rdx, %rax
subq %rcx, %rax
leaq -0x48(%rdx), %rsi
cmpq $0x48, %rax
movq %rcx, %rax
cmoveq %rsi, %rax
cmpq %rcx, %rdx
cmoveq %rsi, %rax
cmpb $0x1, 0x10(%rax)
jne 0x5c5d
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x13f84
movq -0x70(%rbp), %r15
jmp 0x5c71
leaq -0x60(%rbp), %r15
movq %r15, -0x70(%rbp)
movq $0x0, -0x68(%rbp)
movb $0x0, -0x60(%rbp)
callq 0x5060
movq %rax, %r13
movl (%rax), %r14d
movl $0x0, (%rax)
movq %r15, %rdi
leaq -0x98(%rbp), %rsi
movl $0xa, %edx
callq 0x5510
cmpq %r15, -0x98(%rbp)
je 0x60ca
movq %rax, %rbx
addq $-0x80000000, %rax      # imm = 0x80000000
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jb 0x60d6
movl (%r13), %eax
cmpl $0x22, %eax
je 0x60d6
testl %eax, %eax
jne 0x5cd4
movl %r14d, (%r13)
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x5ced
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x5370
leaq 0x19b04(%rip), %rax     # 0x1f7f8
movq (%rax), %rdi
movl %ebx, %esi
callq 0x15464
leaq -0xd8(%rbp), %r14
leaq -0x50(%rbp), %r15
movq %r12, %rdi
callq 0x6224
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x5d26
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x5370
movq %r12, %rdi
leaq 0x10448(%rip), %rsi     # 0x16178
movl $0x10, %edx
callq 0x61b8
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
addq %rdi, %rsi
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
movq %r15, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0x11b78
movl %eax, %ebx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x5d7b
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x5370
movq %r12, %rdi
callq 0x6224
testb %bl, %bl
je 0x5d96
leaq 0x19a6a(%rip), %rax     # 0x1f7f8
movq (%rax), %rdi
callq 0x15522
movq %r12, %rdi
leaq 0x103e0(%rip), %rsi     # 0x16180
movl $0x10, %edx
callq 0x61b8
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
addq %rdi, %rsi
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
movq %r15, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0x11b78
movl %eax, %ebx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x5deb
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x5370
movq %r12, %rdi
callq 0x6224
testb %bl, %bl
je 0x5f54
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
movq %r12, %rdi
leaq 0x10378(%rip), %rsi     # 0x16188
movl $0x10, %edx
callq 0x61b8
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
addq %rdi, %rsi
movq %r15, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0x13d07
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rdx
movq %rdx, %rax
subq %rcx, %rax
leaq -0x48(%rdx), %rsi
cmpq $0x48, %rax
movq %rcx, %rax
cmoveq %rsi, %rax
cmpq %rcx, %rdx
cmoveq %rsi, %rax
cmpb $0x1, 0x10(%rax)
jne 0x5e81
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x13f84
movq -0x70(%rbp), %r15
jmp 0x5e95
leaq -0x60(%rbp), %r15
movq %r15, -0x70(%rbp)
movq $0x0, -0x68(%rbp)
movb $0x0, -0x60(%rbp)
callq 0x5060
movq %rax, %r13
movl (%rax), %r14d
movl $0x0, (%rax)
movq %r15, %rdi
leaq -0x98(%rbp), %rsi
movl $0xa, %edx
callq 0x5510
cmpq %r15, -0x98(%rbp)
je 0x60b2
movq %rax, %rbx
addq $-0x80000000, %rax      # imm = 0x80000000
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jb 0x60be
movl (%r13), %eax
cmpl $0x22, %eax
je 0x60be
testl %eax, %eax
jne 0x5ef8
movl %r14d, (%r13)
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x5f11
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x5370
leaq 0x198e0(%rip), %rax     # 0x1f7f8
movq (%rax), %rdi
decl %ebx
movl %ebx, %esi
callq 0x155fa
leaq -0xd8(%rbp), %r14
leaq -0x50(%rbp), %r15
movq %rax, %rdi
callq 0x15048
movq %r12, %rdi
callq 0x6224
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x5f54
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x5370
movq %r12, %rdi
leaq 0x10236(%rip), %rsi     # 0x16194
movl $0x10, %edx
callq 0x61b8
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
addq %rdi, %rsi
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
movq %r15, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0x11b78
movl %eax, %ebx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x5fa9
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x5370
movq %r12, %rdi
callq 0x6224
testb %bl, %bl
jne 0x6076
movq %r12, %rdi
leaq 0x101d6(%rip), %rsi     # 0x16199
movl $0x10, %edx
callq 0x61b8
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
addq %rdi, %rsi
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
movq %r15, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0x11b78
movl %eax, %ebx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x600e
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x5370
movq %r12, %rdi
callq 0x6224
testb %bl, %bl
je 0x6062
leaq 0x10a5c(%rip), %rdi     # 0x16a7d
callq 0x55a0
leaq 0x10a5a(%rip), %rdi     # 0x16a87
callq 0x55a0
leaq 0x10a59(%rip), %rdi     # 0x16a92
callq 0x55a0
leaq 0x10a73(%rip), %rdi     # 0x16ab8
callq 0x55a0
leaq 0x10a83(%rip), %rdi     # 0x16ad4
callq 0x55a0
leaq 0x10aa2(%rip), %rdi     # 0x16aff
callq 0x55a0
movq %r14, %rdi
callq 0x6224
movq 0x18f67(%rip), %rbx     # 0x1efd8
jmp 0x5b3c
leaq -0xd8(%rbp), %rdi
callq 0x6224
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x609e
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x5370
xorl %eax, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x100e5(%rip), %rdi     # 0x1619e
callq 0x5240
leaq 0x100d9(%rip), %rdi     # 0x1619e
callq 0x5560
leaq 0x100cd(%rip), %rdi     # 0x1619e
callq 0x5240
leaq 0x100c1(%rip), %rdi     # 0x1619e
callq 0x5560
jmp 0x60f6
jmp 0x60f6
jmp 0x60f6
jmp 0x6102
jmp 0x6102
jmp 0x6159
jmp 0x60f6
jmp 0x60f6
jmp 0x6159
jmp 0x615e
movq %rax, %rbx
jmp 0x6132
jmp 0x615e
jmp 0x6190
movq %rax, %rbx
jmp 0x613e
jmp 0x6159
jmp 0x610b
movq %rax, %rbx
cmpl $0x0, (%r13)
jne 0x6119
movl %r14d, (%r13)
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x6132
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x5370
leaq -0xb8(%rbp), %rdi
callq 0x6224
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x6182
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x5370
jmp 0x6182
jmp 0x6159
jmp 0x615e
movq %rax, %rbx
jmp 0x6182
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x6176
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x5370
leaq -0xb8(%rbp), %rdi
callq 0x6224
leaq -0xd8(%rbp), %rdi
callq 0x6224
jmp 0x6193
movq %rax, %rbx
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x61af
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x5370
movq %rbx, %rdi
callq 0x5630
nop