首页
社区
课程
招聘
[求助]请问C++代码怎么看呀。看得头晕呀?最近在分析RealVNC4.1
2011-1-20 09:31 5841

[求助]请问C++代码怎么看呀。看得头晕呀?最近在分析RealVNC4.1

2011-1-20 09:31
5841
请问C++代码怎么看呀。看得头晕呀?最近在分析RealVNC4.1

int main(int argc, const char* argv[]) {
  int result = 0;

  try {
    // - Initialise the available loggers
    //freopen("\\\\drupe\\tjr\\WinVNC4.log","ab",stderr);
    //setbuf(stderr, 0);
    initStdIOLoggers();
       
    initFileLogger("C:\\temp\\WinVNC4.log");
    rfb::win32::initEventLogLogger(VNCServerService::Name);

    // - By default, just log errors to stderr
    logParams.setParam("*:stderr:0");

    // - Print program details and process the command line
    programInfo();
    processParams(argc, argv);
       
    // - Run the server if required
    if (runServer) {
      // Start the network subsystem and run the server
      VNCServerWin32 server;

      if (runAsService) {
        printf("Starting Service-Mode VNC Server.\n");
        VNCServerService service(server);
        service.start();
        result = service.getStatus().dwWin32ExitCode;
      } else {
        printf("Starting User-Mode VNC Server.\n");
        result = server.run(); //这里是我进入VNCServerWin32这个类的代码,也是我要进入的。
      }
    }

    vlog.debug("WinVNC service destroyed");
       
  } catch (rdr::Exception& e) {
    MsgBoxOrLog(e.str(), true);
  }

  vlog.debug("WinVNC process quitting");
  return result;
}

************************************下面就不知道哪个函数是主要的了。一个一个注释了还是找不到。好像是和消息有关。
下面进入  result = server.run(); //

int VNCServerWin32::run() {
  { Lock l(runLock);
    hostThread = Thread::self();
    runServer = true;
  }

  // - Create the tray icon (if possible)
  trayIcon = new STrayIconThread(*this, IDI_ICON, IDI_CONNECTED, IDR_TRAY);

  // - Register for notification of configuration changes
  config.setCallback(this);
  if (isServiceProcess())
    config.setKey(HKEY_LOCAL_MACHINE, RegConfigPath);
  else
    config.setKey(HKEY_CURRENT_USER, RegConfigPath);

  // - Set the address-changed handler for the RFB socket
  rfbSock.setAddressChangeNotifier(this);

  DWORD result = 0;
  try {
    vlog.debug("Entering message loop");

    // - Run the server until we're told to quit
    MSG msg;
    int result = 0;
    while (runServer) {
      result = sockMgr.getMessage(&msg, NULL, 0, 0);
      if (result < 0)
        throw rdr::SystemException("getMessage", GetLastError());
      if (!isServiceProcess() && (result == 0))
        break;
      TranslateMessage(&msg);
      DispatchMessage(&msg);
    }

    vlog.debug("Server exited cleanly");
  } catch (rdr::SystemException &s) {
    vlog.error(s.str());
    result = s.err;
  } catch (rdr::Exception &e) {
    vlog.error(e.str());
  }

  { Lock l(runLock);
    runServer = false;
    hostThread = 0;
  }

  return result;
}

在这里找不到监听端口的代码。大虾们帮忙找一下。我要找到监听部分。看他是从哪里读取的密码

附件太大上传不了。有会分析的帮忙一下,QQ327543449:说明一下VNC分析

[培训]《安卓高级研修班(网课)》月薪三万计划,掌握调试、分析还原ollvm、vmp的方法,定制art虚拟机自动化脱壳的方法

收藏
免费 0
打赏
分享
最新回复 (5)
雪    币: 235
活跃值: (129)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
plume 2011-1-20 11:13
2
0
在这个论坛里,分析主要是逆向,如果你懒得看源码,这是个不错的方法,下断网络初始化函数,栈回搠到你的源码部分
雪    币: 203
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
天涯怪客 2011-1-20 12:46
3
0
我看了源码呀。不过他的类很多。是不是要每个类都先弄明白呀。他不像C哪样好看呀。
他的窗口也不知道在哪里创建的。
雪    币: 348
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
inioo 2011-1-20 17:17
4
0
先弄清思路,再跟踪看,不结合上下文看,确实很头疼
雪    币: 203
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
天涯怪客 2011-1-21 08:43
5
0
这个思路要怎么弄清楚呀?我有源代码的。
雪    币: 243
活跃值: (149)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
xicao 2011-1-21 09:55
6
0
文件太多,如果看屏幕监控,可以搜索下gh0st,DGScreenSpy的源代码看看
游客
登录 | 注册 方可回帖
返回