// File: /workspace/github_cpp_makefile_star2_O2/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 $0xa8, %rsp
leaq -0xa0(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0xb0(%rbp), %r12
pushq $0x10
popq %r14
leaq -0x50(%rbp), %r13
leaq -0xd0(%rbp), %rbx
movq 0x19608(%rip), %rdi     # 0x1efa8
leaq 0xe751(%rip), %rsi      # 0x140f8
callq 0x5380
movq 0x1962d(%rip), %rdi     # 0x1efe0
movq %r12, %rsi
callq 0x50a0
leaq -0x90(%rbp), %r15
movq %r15, %rdi
leaq 0xe736(%rip), %rsi      # 0x14102
movl %r14d, %edx
callq 0x5cfe
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x5d68
testb %al, %al
je 0x5a81
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
leaq -0x70(%rbp), %r15
movq %r15, %rdi
leaq 0xe740(%rip), %rsi      # 0x14142
movl %r14d, %edx
callq 0x5cfe
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x5d84
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
leaq -0x48(%rcx), %rdi
cmpq $0x48, %rdx
movq %rax, %rsi
cmoveq %rdi, %rsi
cmpq %rax, %rcx
cmoveq %rdi, %rsi
movq %rbx, %rdi
callq 0x1250c
movq %rbx, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x5da4
movl %eax, %r15d
movq %rbx, %rdi
callq 0x51e0
leaq 0x19da3(%rip), %rax     # 0x1f808
movq (%rax), %rdi
movl %r15d, %esi
callq 0x135fa
leaq -0x70(%rbp), %rdi
callq 0x5dc6
movq %r13, %rdi
callq 0x5ece
movq %r13, %rdi
leaq 0xe6ed(%rip), %rsi      # 0x14178
movl %r14d, %edx
callq 0x5cfe
movq %r12, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x5d68
movl %eax, %r15d
movq %r13, %rdi
callq 0x5dc6
testb %r15b, %r15b
je 0x5abf
leaq 0x19d51(%rip), %rax     # 0x1f808
movq (%rax), %rdi
callq 0x1369e
movq %r13, %rdi
leaq 0xe6b7(%rip), %rsi      # 0x14180
movl %r14d, %edx
callq 0x5cfe
movq %r12, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x5d68
movl %eax, %r15d
movq %r13, %rdi
callq 0x5dc6
testb %r15b, %r15b
je 0x5b95
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
leaq -0x70(%rbp), %r15
movq %r15, %rdi
leaq 0xe67d(%rip), %rsi      # 0x14188
movl %r14d, %edx
callq 0x5cfe
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x5d84
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
leaq -0x48(%rcx), %rdi
cmpq $0x48, %rdx
movq %rax, %rsi
cmoveq %rdi, %rsi
cmpq %rax, %rcx
cmoveq %rdi, %rsi
movq %rbx, %rdi
callq 0x1250c
movq %rbx, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x5da4
movl %eax, %r15d
movq %rbx, %rdi
callq 0x51e0
leaq 0x19c9a(%rip), %rax     # 0x1f808
movq (%rax), %rdi
decl %r15d
movl %r15d, %esi
callq 0x1371e
movq %rax, %rdi
callq 0x13338
leaq -0x70(%rbp), %rdi
callq 0x5dc6
movq %r13, %rdi
callq 0x5ece
movq %r13, %rdi
leaq 0xe5f5(%rip), %rsi      # 0x14194
movl %r14d, %edx
callq 0x5cfe
movq %r12, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x5d68
movl %eax, %r15d
movq %r13, %rdi
callq 0x5dc6
testb %r15b, %r15b
jne 0x5c50
movq %r13, %rdi
leaq 0xe5c7(%rip), %rsi      # 0x14199
movl %r14d, %edx
callq 0x5cfe
movq %r12, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x5d68
movl %eax, %r15d
movq %r13, %rdi
callq 0x5dc6
testb %r15b, %r15b
je 0x5c3f
leaq 0xee7f(%rip), %rdi      # 0x14a7d
callq 0x55b0
leaq 0xee7d(%rip), %rdi      # 0x14a87
callq 0x55b0
leaq 0xee7c(%rip), %rdi      # 0x14a92
callq 0x55b0
leaq 0xee96(%rip), %rdi      # 0x14ab8
callq 0x55b0
leaq 0xeea6(%rip), %rdi      # 0x14ad4
callq 0x55b0
leaq 0xeec5(%rip), %rdi      # 0x14aff
callq 0x55b0
leaq -0x90(%rbp), %rdi
callq 0x5dc6
jmp 0x5999
leaq -0x90(%rbp), %rdi
callq 0x5dc6
leaq -0xb0(%rbp), %rdi
callq 0x51e0
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5cae
jmp 0x5c82
jmp 0x5cae
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x51e0
jmp 0x5cb1
jmp 0x5c99
jmp 0x5cae
jmp 0x5cae
movq %rax, %rbx
jmp 0x5cba
jmp 0x5cae
jmp 0x5cc7
jmp 0x5cd5
jmp 0x5cf8
jmp 0x5cd5
jmp 0x5cc7
jmp 0x5cd5
jmp 0x5cc7
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x5dc6
leaq -0x50(%rbp), %rdi
callq 0x5ece
jmp 0x5cd8
jmp 0x5cd5
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x5dc6
jmp 0x5cd8
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x5dc6
leaq -0xb0(%rbp), %rdi
callq 0x51e0
movq %rbx, %rdi
callq 0x5660
movq %rax, %rbx
jmp 0x5ce4
nop