Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Work Issues
  4. Working with Rexec

Working with Rexec

Scheduled Pinned Locked Moved Work Issues
c++data-structuressecuritydebuggingregex
2 Posts 2 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    hi, I'm working with Rexec in visual C++. I don't know any C++ so the going is slow. My task was to change the service, edit security so only certain ip's could remote execute. I succeded but, it only works in the debug mode used when -d is passed instead of -i and then allowing it to interact with the desktop. So when running as a Service it no longer does anything. I open a file and read data from it for the security addition and i'm wondering if that is the reason it doesn't work. can services do file manipulation? Any help is much appreciated, advice also welcomed because i'm a newb. here is the code i added, it shouldn't have an affect anywhere else: CAsyncSocket SrvSock; SrvSock.Create(9987); SrvSock.Listen(); CAsyncSocket CliSock; // struct sockaddr addr; struct sockaddr_in from; //putting all hosts.txt values in an array for faster more effecient check int count = 0; int i = 0; string ip; string ipArray[MAX_IP]; ifstream openFile("hosts.txt"); while(openFile.peek() != EOF) { openFile >> ip; openFile.ignore(255, '\n'); ipArray[count] = ip; count++; } printf("array initialized with %d values\n", count); openFile.close(); int nSize = sizeof(SOCKADDR); // Loop to maintain the search while the application is running. while (!m_pStop->Lock(0)) { // Check to see if a connection is being attempted. if(SrvSock.Accept(CliSock, (struct sockaddr*)&from, &nSize)) { printf("Remote Address %s \n", inet_ntoa(from.sin_addr));//andrew: to print ip SOCKET hSock = CliSock.m_hSocket; CliSock.Detach(); while(ip != "") { ip = ipArray[i]; if(inet_ntoa(from.sin_addr) == ip) //.compare(ip) == 0) { printf("MATCH Verified\nACCESS GRANTED!\n\n"); //Let a seperate thread handle the individual connections: AfxBeginThread(ProcConnectionFunc, (LPVOID)hSock); i = 0; break; } if(ipArray[i+1] == "") { printf("Verification Failed\nACCESS DENIED!\n"); ip = ""; i = 0; } i++; } ip = " "; // openFile.close(); } Sleep(1); } // Clean up... SrvSock.Close(); }

    R 1 Reply Last reply
    0
    • L Lost User

      hi, I'm working with Rexec in visual C++. I don't know any C++ so the going is slow. My task was to change the service, edit security so only certain ip's could remote execute. I succeded but, it only works in the debug mode used when -d is passed instead of -i and then allowing it to interact with the desktop. So when running as a Service it no longer does anything. I open a file and read data from it for the security addition and i'm wondering if that is the reason it doesn't work. can services do file manipulation? Any help is much appreciated, advice also welcomed because i'm a newb. here is the code i added, it shouldn't have an affect anywhere else: CAsyncSocket SrvSock; SrvSock.Create(9987); SrvSock.Listen(); CAsyncSocket CliSock; // struct sockaddr addr; struct sockaddr_in from; //putting all hosts.txt values in an array for faster more effecient check int count = 0; int i = 0; string ip; string ipArray[MAX_IP]; ifstream openFile("hosts.txt"); while(openFile.peek() != EOF) { openFile >> ip; openFile.ignore(255, '\n'); ipArray[count] = ip; count++; } printf("array initialized with %d values\n", count); openFile.close(); int nSize = sizeof(SOCKADDR); // Loop to maintain the search while the application is running. while (!m_pStop->Lock(0)) { // Check to see if a connection is being attempted. if(SrvSock.Accept(CliSock, (struct sockaddr*)&from, &nSize)) { printf("Remote Address %s \n", inet_ntoa(from.sin_addr));//andrew: to print ip SOCKET hSock = CliSock.m_hSocket; CliSock.Detach(); while(ip != "") { ip = ipArray[i]; if(inet_ntoa(from.sin_addr) == ip) //.compare(ip) == 0) { printf("MATCH Verified\nACCESS GRANTED!\n\n"); //Let a seperate thread handle the individual connections: AfxBeginThread(ProcConnectionFunc, (LPVOID)hSock); i = 0; break; } if(ipArray[i+1] == "") { printf("Verification Failed\nACCESS DENIED!\n"); ip = ""; i = 0; } i++; } ip = " "; // openFile.close(); } Sleep(1); } // Clean up... SrvSock.Close(); }

      R Offline
      R Offline
      RB Emphasys
      wrote on last edited by
      #2

      I would try reposting this in the c++ forum, this isnt really the correct place for those types of questions. http://www.codeproject.com/script/comments/forums.asp?forumid=1647 Ryan

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups