SSH No-Login Shell

Aus MHC-Wiki

Wechseln zu: Navigation, Suche
#include <stdio.h>
#include <curses.h>
#include <time.h>
main()
{
  int c;
  time_t t0, t1;
  t0 = time(NULL);
  initscr();
  timeout(10000);
  noecho();
  nonl();
  mvprintw (1,1,"==========");
  mvprintw (2,1,"SSH-Tunnel");
  mvprintw (3,1,"==========");
  mvprintw (6,1,"Druecken Sie \"X\" um die Sitzung zu beenden!");
  for (;;)
  {
     c = getch();
     if ((char)c == 'X')
       return;
     t1 = time(NULL);
     mvprintw(8,1,"Sie sind seit %d Sekunden online.\n", (int)difftime(t1,t0));
  }
}
Persönliche Werkzeuge
Navigation