Created
August 6, 2022 13:27
-
-
Save luckythandel/3a5c951b83745ee1cc9ecac3feb37819 to your computer and use it in GitHub Desktop.
TN MouseServer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(undefined4 param_1,undefined4 param_2) | |
{ | |
int *piVar1; | |
char *pcVar2; | |
int iVar3; | |
allocator *paVar4; | |
SessionContext *pSVar5; | |
undefined4 uVar6; | |
int in_GS_OFFSET; | |
undefined4 local_80; | |
pthread_t local_7c; | |
socklen_t local_78; | |
undefined4 local_74; | |
pthread_t local_70; | |
undefined4 local_6c; | |
int local_68; | |
int local_64; | |
SessionContext *local_60; | |
undefined local_5c [4]; | |
undefined4 local_58; | |
undefined local_4c [16]; | |
basic_string local_3c [6]; | |
undefined4 local_24; | |
undefined4 *puStack20; | |
uVar6 = param_2; | |
puStack20 = ¶m_1; | |
local_24 = *(undefined4 *)(in_GS_OFFSET + 0x14); | |
signal(0xd,(__sighandler_t)0x1); | |
_argc = param_1; | |
_argv = uVar6; | |
local_6c = 0x23; | |
openlog("mouse server",0x23,0x18); | |
syslog(6,"started on port %d",0x7ba); | |
daemon(1,1); | |
bzero(local_5c,0x10); | |
local_5c._0_2_ = 2; | |
local_58 = 0; | |
local_5c._2_2_ = htons(0x7ba); | |
local_68 = socket(2,1,0); | |
if (local_68 < 0) { | |
piVar1 = __errno_location(); | |
pcVar2 = strerror(*piVar1); | |
syslog(3,"socket: %s",pcVar2); | |
/* WARNING: Subroutine does not return */ | |
exit(1); | |
} | |
local_80 = 1; | |
iVar3 = setsockopt(local_68,1,2,&local_80,4); | |
if (iVar3 < 0) { | |
piVar1 = __errno_location(); | |
pcVar2 = strerror(*piVar1); | |
syslog(3,"setsockopt: %s",pcVar2); | |
/* WARNING: Subroutine does not return */ | |
exit(1); | |
} | |
iVar3 = bind(local_68,(sockaddr *)local_5c,0x10); | |
if (iVar3 < 0) { | |
piVar1 = __errno_location(); | |
pcVar2 = strerror(*piVar1); | |
syslog(3,"bind: %s",pcVar2); | |
/* WARNING: Subroutine does not return */ | |
exit(1); | |
} | |
iVar3 = listen(local_68,2); | |
if (iVar3 < 0) { | |
piVar1 = __errno_location(); | |
pcVar2 = strerror(*piVar1); | |
syslog(3,"listen: %s",pcVar2); | |
/* WARNING: Subroutine does not return */ | |
exit(1); | |
} | |
iVar3 = pthread_create(&local_7c,(pthread_attr_t *)0x0,GTKStartup,(void *)0x0); | |
if (iVar3 == -1) { | |
piVar1 = __errno_location(); | |
pcVar2 = strerror(*piVar1); | |
syslog(4,"pthread_create failed: %s",pcVar2); | |
} | |
iVar3 = pthread_create(&local_70,(pthread_attr_t *)0x0,udpsender,(void *)0x0); | |
if (iVar3 == -1) { | |
syslog(3,"pthread_create udpsender failed"); | |
} | |
iVar3 = pthread_create(&local_70,(pthread_attr_t *)0x0,udpserver,(void *)0x0); | |
if (iVar3 == -1) { | |
syslog(3,"pthread_create udpserver failed"); | |
} | |
do { | |
while( true ) { | |
local_78 = 0x10; | |
puts("accept client....."); | |
local_64 = accept(local_68,(sockaddr *)local_4c,&local_78); | |
if (-1 < local_64) break; | |
piVar1 = __errno_location(); | |
pcVar2 = strerror(*piVar1); | |
syslog(4,"accept failed: %s",pcVar2); | |
} | |
local_74 = 1; | |
setsockopt(local_64,6,1,&local_74,4); | |
puts("start session....."); | |
std::allocator<char>::allocator(); | |
paVar4 = (allocator *)inet_ntoa(local_4c._4_4_); | |
/* try { // try from 08053362 to 08053366 has its CatchHandler @ 080534f9 */ | |
std::__cxx11::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string | |
((char *)local_3c,paVar4); | |
/* try { // try from 08053372 to 08053376 has its CatchHandler @ 080534e6 */ | |
pSVar5 = (SessionContext *)operator.new(0x1c); | |
/* try { // try from 08053384 to 08053388 has its CatchHandler @ 080534d4 */ | |
SessionContext::SessionContext(pSVar5,local_64,(basic_string)local_3c); | |
local_60 = pSVar5; | |
/* try { // try from 08053396 to 0805339a has its CatchHandler @ 080534f9 */ | |
std::__cxx11::basic_string<char,std::char_traits<char>,std::allocator<char>>::~basic_string | |
((basic_string<char,std::char_traits<char>,std::allocator<char>> *)local_3c); | |
std::allocator<char>::~allocator((allocator<char> *)&local_70); | |
pcVar2 = " connected"; | |
std::operator+(local_3c,(char *)(local_60 + 4)); | |
/* try { // try from 080533cf to 080533e7 has its CatchHandler @ 08053515 */ | |
uVar6 = std::__cxx11::basic_string<char,std::char_traits<char>,std::allocator<char>>::c_str(); | |
gtk_status_icon_set_tooltip(tray,uVar6,pcVar2); | |
std::__cxx11::basic_string<char,std::char_traits<char>,std::allocator<char>>::~basic_string | |
((basic_string<char,std::char_traits<char>,std::allocator<char>> *)local_3c); | |
gtk_status_icon_set_from_file(tray,"/usr/share/mouseserver/icons/ms-connected.svg"); | |
puts("thread to process wifi mouse data....."); | |
iVar3 = pthread_create(&local_70,(pthread_attr_t *)0x0,MobileMouseSession,local_60); | |
if (iVar3 == -1) { | |
piVar1 = __errno_location(); | |
pcVar2 = strerror(*piVar1); | |
syslog(4,"pthread_create failed: %s",pcVar2); | |
pSVar5 = local_60; | |
if (local_60 != (SessionContext *)0x0) { | |
SessionContext::~SessionContext(local_60); | |
operator.delete(pSVar5); | |
} | |
close(local_64); | |
} | |
puts("thread created OK....."); | |
gtk_status_icon_set_tooltip(tray,"Mouse Server"); | |
gtk_status_icon_set_from_file(tray,"/usr/share/mouseserver/icons/ms-default.svg"); | |
} while( true ); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment