Hack Attacks Revealed A Complete Reference with Custom Security Hacking Toolkit phần 5

pdf
Số trang Hack Attacks Revealed A Complete Reference with Custom Security Hacking Toolkit phần 5 83 Cỡ tệp Hack Attacks Revealed A Complete Reference with Custom Security Hacking Toolkit phần 5 668 KB Lượt tải Hack Attacks Revealed A Complete Reference with Custom Security Hacking Toolkit phần 5 0 Lượt đọc Hack Attacks Revealed A Complete Reference with Custom Security Hacking Toolkit phần 5 0
Đánh giá Hack Attacks Revealed A Complete Reference with Custom Security Hacking Toolkit phần 5
4.7 ( 9 lượt)
Nhấn vào bên dưới để tải tài liệu
Đang xem trước 10 trên tổng 83 trang, để tải xuống xem đầy đủ hãy nhấn vào bên trên
Chủ đề liên quan

Nội dung

char char char char char town[31]; county[31]; post[13]; telephone[16]; fax[16]; } data; extern char fpath[]; static char scr[4000]; static char sbuff[2000]; char stext[30]; data rec; int handle; int recsize; union REGS inreg,outreg; /* Function prototypes */ void FATAL(char *); void OPENDATA(void); void CONTINUE(void); void EXPORT_MULTI(void); void GETDATA(int); int GETOPT(void); void DISPDATA(void); void ADD_REC(void); void PRINT_MULTI(void); void SEARCH(void); void MENU(void); int GET_MOUSE(int *buttons) { inreg.x.ax = 0; int86(0x33,&inreg,&outreg); *buttons = outreg.x.bx; return outreg.x.ax; } void MOUSE_CURSOR(int status) { /* Status = 0 cursor off */ /* 1 cursor on */ inreg.x.ax = 2 - status; int86(0x33,&inreg,&outreg); } int MOUSE_LOCATION(int *x, int *y) { 319 inreg.x.ax = 3; int86(0x33,&inreg,&outreg); *x = outreg.x.cx / 8; *y = outreg.x.dx / 8; return outreg.x.bx; } int GETOPT() { int result; int x; int y; do { do { result = MOUSE_LOCATION(&x,&y); if (result & 1) { if (x >= 52 && x <= 53 && y >= 7 && y <= 15) return y - 7; if (x >= 4 && x <= 40 && y >= 7 && y <= 14) return y + 10; if (x >= 4 && x <= 40 && y == 15) return y + 10; } } while(!bioskey(1)); result = bioskey(0); x = result & 0xff; if (x == 0) { result = result >> 8; result -= 60; } } while(result < 0 || result > 8); return result; } void setvideo(unsigned char mode) { /* Sets the video display mode and clears the screen */ inreg.h.al = mode; inreg.h.ah = 0x00; int86(0x10, &inreg, &outreg); } 320 int activepage(void) { /* Returns the currently selected video display page */ union REGS inreg,outreg; inreg.h.ah = 0x0F; int86(0x10, &inreg, &outreg); return(outreg.h.bh); } void print(char *str) { /* Prints characters only directly to the current display page starting at the current cursor position. The cursor is not advanced. This function assumes a COLOR display card. For use with a monochrome display card change 0xB800 to read 0xB000 */ int page; int offset; unsigned row; unsigned col; char far *ptr; page = activepage(); curr_cursor(&row,&col); offset = page * 4000 + row * 160 + col * 2; ptr = MK_FP(0xB800,offset); while(*str) { *ptr++= *str++; ptr++; } } void TRUESHADE(int lef, int top, int right, int bottom) { int n; /* True Shading of a screen block */ gettext(lef,top,right,bottom,sbuff); for(n = 1; n < 2000; n+= 2) sbuff[n] = 7; puttext(lef,top,right,bottom,sbuff); } 321 void DBOX(int l, int t, int r, int b) { /* Draws a double line box around the described area */ int n; cursor(t,l); print("E"); for(n = 1; n < r - l; n++) { cursor(t,l + n); print("I"); } cursor(t,r); print("»"); for (n = t + 1; n < b; n++) { cursor(n,l); print("º"); cursor(n,r); print("º"); } cursor(b,l); print("E"); for(n = 1; n < r - l; n++) { cursor(b,l+n); print("I"); } cursor(b,r); print("1/4"); } int INPUT(char *text,unsigned length) { /* Receive a string from the operator */ unsigned key_pos; int key; unsigned start_row; unsigned start_col; unsigned end; char temp[80]; char *p; curr_cursor(&start_row,&start_col); key_pos = 0; end = strlen(text); for(;;) { key = bioskey(0); 322 if ((key & 0xFF) == 0) { key = key >> 8; if (key == 79) { while(key_pos < end) key_pos++; cursor(start_row,start_col + key_pos); } else if (key == 71) { key_pos = 0; cursor(start_row,start_col); } else if ((key == 75) && (key_pos > 0)) { key_pos--; cursor(start_row,start_col + key_pos); } else if ((key == 77) && (key_pos < end)) { key_pos++; cursor(start_row,start_col + key_pos); } else if (key == 83) { p = text + key_pos; while(*(p+1)) { *p = *(p+1); p++; } *p = 32; if (end > 0) end--; cursor(start_row,start_col); cprintf(text); cprintf(" "); if ((key_pos > 0) && (key_pos == end)) key_pos--; cursor(start_row,start_col + key_pos); } } else { key = key & 0xFF; if (key == 13 || key == 27) break; else 323 if ((key == 8) && (key_pos > 0)) { end--; key_pos--; text[key_pos--] = '\0'; strcpy(temp,text); p = text + key_pos + 2; strcat(temp,p); strcpy(text,temp); cursor(start_row,start_col); cprintf("%-*.*s",length,length,text); key_pos++; cursor(start_row,start_col + key_pos); } else if ((key > 31) && (key_pos < length) && (start_col + key_pos < 80)) { if (key_pos <= end) { p = text + key_pos; memmove(p+1,p,end - key_pos); if (end < length) end++; text[end] = '\0'; } text[key_pos++] = (char)key; if (key_pos > end) { end++; text[end] = '\0'; } cursor(start_row,start_col); cprintf("%-*.*s",length,length,text); cursor(start_row,start_col + key_pos); } } } text[end] = '\0'; return key; } void FATAL(char *error) { /* A fatal error has occured */ printf ("\nFATAL ERROR: %s",error); exit(0); } void OPENDATA() { /* Check for existence of data file and if not create it */ 324 /* otherwise open it for reading/writing at end of file */ handle = open(fpath,O_RDWR,S_IWRITE); if (handle == -1) { handle = open(fpath,O_RDWR|O_CREAT,S_IWRITE); if (handle == -1) FATAL("Unable to create data file"); } /* Read in first rec */ read(handle,&rec,recsize); } void CLOSEDATA() { close(handle); } void GETDATA(int start) { /* Get address data from operator */ textcolor(BLACK); textbackground(GREEN); gotoxy(left,8); print("Name "); gotoxy(left,9); print("Company "); gotoxy(left,10); print("Address "); gotoxy(left,11); print("Area "); gotoxy(left,12); print("Town "); gotoxy(left,13); print("County "); gotoxy(left,14); print("Post Code "); gotoxy(left,15); print("Telephone "); gotoxy(left,16); print("Fax "); switch(start) { case 0: gotoxy(left + 10,8); if(INPUT(rec.name,30) == 27) break; case 1: gotoxy(left + 10,9); if(INPUT(rec.company,30) == 27) break; case 2: gotoxy(left + 10,10); 325 if(INPUT(rec.address,30) == 27) break; case 3: gotoxy(left + 10,11); if(INPUT(rec.area,30) == 27) break; case 4: gotoxy(left + 10,12); if(INPUT(rec.town,30) == 27) break; case 5: gotoxy(left + 10,13); if(INPUT(rec.county,30) == 27) break; case 6: gotoxy(left + 10,14); if(INPUT(rec.post,12) == 27) break; case 7: gotoxy(left + 10,15); if(INPUT(rec.telephone,15) == 27) break; case 8: gotoxy(left + 10,16); INPUT(rec.fax,15); break; } textcolor(WHITE); textbackground(RED); gotoxy(left + 23,21); print(" "); } void DISPDATA() { /* Display address data */ textcolor(BLACK); textbackground(GREEN); cursor(7,3); cprintf("Name %-30.30s",rec.name); cursor(8,3); cprintf("Company %-30.30s",rec.company); cursor(9,3); cprintf("Address %-30.30s",rec.address); cursor(10,3); cprintf("Area %-30.30s",rec.area); cursor(11,3); cprintf("Town %-30.30s",rec.town); cursor(12,3); cprintf("County %-30.30s",rec.county); cursor(13,3); cprintf("Post Code %-30.30s",rec.post); cursor(14,3); cprintf("Telephone %-30.30s",rec.telephone); cursor(15,3); cprintf("Fax %-30.30s",rec.fax); } int LOCATE(char *text) 326 { int result; do { /* Read rec into memory */ result = read(handle,&rec,recsize); if (result > 0) { /* Scan rec for matching data */ if (strstr(strupr(rec.name),text) != NULL) return(1); if (strstr(strupr(rec.company),text) != NULL) return(1); if (strstr(strupr(rec.address),text) != NULL) return(1); if (strstr(strupr(rec.area),text) != NULL) return(1); if (strstr(strupr(rec.town),text) != NULL) return(1); if (strstr(strupr(rec.county),text) != NULL) return(1); if (strstr(strupr(rec.post),text) != NULL) return(1); if (strstr(strupr(rec.telephone),text) != NULL) return(1); if (strstr(strupr(rec.fax),text) != NULL) return(1); } } while(result > 0); return(0); } void SEARCH() { int result; gotoxy(left,21); textcolor(WHITE); textbackground(RED); cprintf("Enter data to search for "); strcpy(stext,""); INPUT(stext,30); if (*stext == 0) { gotoxy(left,21); cprintf("%70c",32); return; } gotoxy(left,21); textcolor(WHITE); textbackground(RED); 327 cprintf("Searching for %s Please Wait… .",stext); strupr(stext); /* Locate start of file */ lseek(handle,0,SEEK_SET); result = LOCATE(stext); if (result == 0) { gotoxy(left,21); cprintf("%70c",32); gotoxy(left + 27,21); cprintf("NO MATCHING RECORDS"); gotoxy(left + 24,22); cprintf("Press RETURN to Continue"); bioskey(0); gotoxy(left,21); cprintf("%70c",32); gotoxy(left,22); cprintf("%70c",32); } else { lseek(handle,0 - recsize,SEEK_CUR); read(handle,&rec,recsize); DISPDATA(); } textcolor(WHITE); textbackground(RED); gotoxy(left,21); cprintf("%70c",32); textcolor(BLACK); textbackground(GREEN); } void CONTINUE() { int result; long curpos; curpos = tell(handle) - recsize; result = LOCATE(stext); textcolor(WHITE); textbackground(RED); if (result == 0) { gotoxy(left + 24,21); cprintf("NO MORE MATCHING RECORDS"); gotoxy(left + 24,22); cprintf("Press RETURN to Continue"); bioskey(0); gotoxy(left,21); cprintf("%70c",32); gotoxy(left,22); 328
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.