// File: 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
subq $0x1f0, %rsp            # imm = 0x1F0
movl $0x0, -0x4(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x6690
jmp 0x6c1d
movq 0x46384(%rip), %rdi     # 0x4cfa8
leaq 0x2d549(%rip), %rsi     # 0x34174
callq 0x64a0
jmp 0x6c32
movq 0x463a7(%rip), %rdi     # 0x4cfe0
leaq -0x28(%rbp), %rsi
callq 0x60e0
jmp 0x6c44
leaq 0x2d533(%rip), %rsi     # 0x3417e
leaq -0x58(%rbp), %rdi
movl $0x10, %edx
callq 0x7190
jmp 0x6c5b
leaq -0x28(%rbp), %rdi
leaq -0x58(%rbp), %rsi
xorl %edx, %edx
callq 0x7230
movb %al, -0x1b1(%rbp)
jmp 0x6c72
movb -0x1b1(%rbp), %al
testb $0x1, %al
jne 0x6c81
jmp 0x6dbc
leaq -0x78(%rbp), %rdi
callq 0x7280
jmp 0x6c8c
leaq 0x2d52b(%rip), %rsi     # 0x341be
leaq -0x98(%rbp), %rdi
movl $0x10, %edx
callq 0x7190
jmp 0x6ca6
leaq -0x28(%rbp), %rdi
leaq -0x78(%rbp), %rsi
leaq -0x98(%rbp), %rdx
xorl %ecx, %ecx
callq 0x72c0
jmp 0x6cbe
xorl %eax, %eax
movl %eax, %esi
leaq -0x78(%rbp), %rdi
callq 0x7360
movq %rax, -0x1c0(%rbp)
jmp 0x6cd4
movq -0x1c0(%rbp), %rsi
leaq -0xc0(%rbp), %rdi
callq 0x73d0
jmp 0x6ce9
xorl %eax, %eax
movl %eax, %esi
leaq -0xc0(%rbp), %rdi
movl $0xa, %edx
callq 0x7320
movl %eax, -0x1c4(%rbp)
jmp 0x6d06
leaq -0xc0(%rbp), %rdi
callq 0x6330
movl -0x1c4(%rbp), %eax
movl %eax, -0x9c(%rbp)
leaq 0x46bf3(%rip), %rax     # 0x4d918
movq (%rax), %rdi
movl -0x9c(%rbp), %esi
callq 0x32100
jmp 0x6d35
leaq -0x98(%rbp), %rdi
callq 0x7400
leaq -0x78(%rbp), %rdi
callq 0x7430
jmp 0x6dbc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x717a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x7149
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x6dae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x6da2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x6330
leaq -0x98(%rbp), %rdi
callq 0x7400
leaq -0x78(%rbp), %rdi
callq 0x7430
jmp 0x7149
leaq 0x2d431(%rip), %rsi     # 0x341f4
leaq -0xe0(%rbp), %rdi
movl $0x10, %edx
callq 0x7190
jmp 0x6dd6
leaq -0x28(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
xorl %edx, %edx
callq 0x7230
movb %al, -0x1c5(%rbp)
jmp 0x6df0
leaq -0xe0(%rbp), %rdi
callq 0x7400
movb -0x1c5(%rbp), %al
testb $0x1, %al
jne 0x6e08
jmp 0x6e38
leaq 0x46b09(%rip), %rax     # 0x4d918
movq (%rax), %rdi
callq 0x321d0
jmp 0x6e19
jmp 0x6e38
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x7400
jmp 0x7149
leaq 0x2d3bd(%rip), %rsi     # 0x341fc
leaq -0x100(%rbp), %rdi
movl $0x10, %edx
callq 0x7190
jmp 0x6e52
leaq -0x28(%rbp), %rdi
leaq -0x100(%rbp), %rsi
xorl %edx, %edx
callq 0x7230
movb %al, -0x1c6(%rbp)
jmp 0x6e6c
leaq -0x100(%rbp), %rdi
callq 0x7400
movb -0x1c6(%rbp), %al
testb $0x1, %al
jne 0x6e87
jmp 0x6fe3
leaq -0x120(%rbp), %rdi
callq 0x7280
jmp 0x6e95
leaq 0x2d368(%rip), %rsi     # 0x34204
leaq -0x140(%rbp), %rdi
movl $0x10, %edx
callq 0x7190
jmp 0x6eaf
leaq -0x28(%rbp), %rdi
leaq -0x120(%rbp), %rsi
leaq -0x140(%rbp), %rdx
xorl %ecx, %ecx
callq 0x72c0
jmp 0x6eca
xorl %eax, %eax
movl %eax, %esi
leaq -0x120(%rbp), %rdi
callq 0x7360
movq %rax, -0x1d0(%rbp)
jmp 0x6ee3
movq -0x1d0(%rbp), %rsi
leaq -0x168(%rbp), %rdi
callq 0x73d0
jmp 0x6ef8
xorl %eax, %eax
movl %eax, %esi
leaq -0x168(%rbp), %rdi
movl $0xa, %edx
callq 0x7320
movl %eax, -0x1d4(%rbp)
jmp 0x6f15
leaq -0x168(%rbp), %rdi
callq 0x6330
movl -0x1d4(%rbp), %eax
movl %eax, -0x144(%rbp)
leaq 0x469e4(%rip), %rax     # 0x4d918
movq (%rax), %rdi
movl -0x144(%rbp), %esi
decl %esi
callq 0x32290
movq %rax, -0x1e0(%rbp)
jmp 0x6f4d
movq -0x1e0(%rbp), %rdi
callq 0x31c70
jmp 0x6f5b
leaq -0x140(%rbp), %rdi
callq 0x7400
leaq -0x120(%rbp), %rdi
callq 0x7430
jmp 0x6fe3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x7400
jmp 0x7149
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x6fd2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x6fc6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x6330
leaq -0x140(%rbp), %rdi
callq 0x7400
leaq -0x120(%rbp), %rdi
callq 0x7430
jmp 0x7149
leaq 0x2d226(%rip), %rsi     # 0x34210
leaq -0x188(%rbp), %rdi
movl $0x10, %edx
callq 0x7190
jmp 0x6ffd
leaq -0x28(%rbp), %rdi
leaq -0x188(%rbp), %rsi
xorl %edx, %edx
callq 0x7230
movb %al, -0x1e1(%rbp)
jmp 0x7017
leaq -0x188(%rbp), %rdi
callq 0x7400
movb -0x1e1(%rbp), %al
testb $0x1, %al
jne 0x702f
jmp 0x705b
movl $0x3, -0x18c(%rbp)
jmp 0x712d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x7400
jmp 0x7149
leaq 0x2d1b3(%rip), %rsi     # 0x34215
leaq -0x1b0(%rbp), %rdi
movl $0x10, %edx
callq 0x7190
jmp 0x7075
leaq -0x28(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
xorl %edx, %edx
callq 0x7230
movb %al, -0x1e2(%rbp)
jmp 0x708f
leaq -0x1b0(%rbp), %rdi
callq 0x7400
movb -0x1e2(%rbp), %al
testb $0x1, %al
jne 0x70a7
jmp 0x7123
leaq 0x2d16c(%rip), %rdi     # 0x3421a
xorl %eax, %eax
callq 0x6090
jmp 0x70b7
leaq 0x2d167(%rip), %rdi     # 0x34225
xorl %eax, %eax
callq 0x6090
jmp 0x70c7
leaq 0x2d163(%rip), %rdi     # 0x34231
xorl %eax, %eax
callq 0x6090
jmp 0x70d7
leaq 0x2d17a(%rip), %rdi     # 0x34258
xorl %eax, %eax
callq 0x6090
jmp 0x70e7
leaq 0x2d187(%rip), %rdi     # 0x34275
xorl %eax, %eax
callq 0x6090
jmp 0x70f7
leaq 0x2d1a3(%rip), %rdi     # 0x342a1
xorl %eax, %eax
callq 0x6090
jmp 0x7107
jmp 0x7123
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x7400
jmp 0x7149
movl $0x0, -0x18c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x7400
movl -0x18c(%rbp), %eax
testl %eax, %eax
je 0x7144
jmp 0x7142
jmp 0x7154
jmp 0x6c1b
leaq -0x58(%rbp), %rdi
callq 0x7400
jmp 0x717a
movl $0x0, -0x4(%rbp)
movl $0x1, -0x18c(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x6330
movl -0x4(%rbp), %eax
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x6330
movq -0x30(%rbp), %rdi
callq 0x6850
nopl (%rax)