EG Information
Training Missions
Knowledge Bank
Pimp Us Out!
Has Enigma Group Helped You? Then Help Us By Advertising For Us. Place One Of The Following Images On Your Site And Create A Link Back To Enigma Group.
|
| |
Affiliates
|
|
Enigma Group's Code Bank
Simple ASM RS232 Transmitter CodeBy: mamb0 - Date Submitted: 2009-04-02 22:27:12 Assembler RS232 Data Transmitter*/ #include <stdio.h> #include <conio.h> #define CNTRLZ 0x1A int main(void) { char readmode[] = "r"; char writemode[] = "w"; char datafile[] = "H:\\text.txt" ; char filefailed[] = "This file has failed to load\n"; char comport[] = "COM1"; char comfail[] = "Failed to open COM\n"; char startmsg[] = "CSA File Transfer Program\n"; int char_send; FILE * dp; FILE * fp; __asm { lea eax, startmsg //load start message 'Message' push eax // call dword ptr [printf] //display start message add esp, 4 //clear stack //*if ((fp = fopen("H:\\text.txt", "r")) == NULL)*// lea eax, readmode // push eax // lea eax, datafile //load H:\\text.txt push eax // call dword ptr [fopen] //read datafile H:\\txt.txt add esp,8 // mov dword ptr [fp], eax // cmp dword ptr [fp], 0 //compare file point with zero jnz comport_open //Open COM1 for file transfer if file point is 0 //*printf(""This file has failed to load/n"); return 1;*// lea eax, filefailed // push eax // call dword ptr [printf] //display 'This file has failed to load' if there is no H:\\.txt.txt add esp, 4 // jmp end_of_asm_program //Jump to the end of the program comport_open: //*if ((dp = fopen("COM1", "w")) == NULL) {*// //*printf("fail to open COM port\n"); return 1;*// lea eax, writemode // push eax // lea eax, comport // push eax // call dword ptr [fopen] //Open COM port 1 for file transfer add esp, 8 // mov dword ptr [dp], eax // cmp dword ptr [dp], 0 //compare destination point to 0 jnz notEOF //if destination point is 0 jump to file sending sub routine lea eax, comfail // push eax // call dword ptr [printf] //Display 'Failed to open COM' if teh COM port cannot be opened add esp, 4 // jmp end_of_asm_program // //*while ((c = fgetc(fp )) != EOF) {*// //*fputc( c, dp);*// notEOF: mov eax, dword ptr [fp] // push eax // call dword ptr [fgetc] //send encrypted character add esp, 4 // mov char_send, eax // cmp char_send, 0FFFFFFFFh //compare current character with the end of the file Je close_file // mov eax, dp // push eax // mov eax, char_send // xor eax, 0e4h //encrypt character by hex value '228' push eax // call dword ptr [fputc] //transfer the file to the destination add esp,8 // Jmp notEOF // close_file: //close both the file and its transfer parameters mov eax, dp // push eax // mov eax, 3fh // push eax // call dword ptr [fputc] // add esp, 8 // mov eax, fp // push eax // call dword ptr [fclose] // add esp, 4 // mov eax, dp // push eax // call dword ptr [fclose] // add esp, 4 // end_of_asm_program: } return 0; }
|
| Return to
asm category list |
|
|
Who Visited EnigmaGroup Today?
1587 Guests, 266 Users (185 Spiders)
JohnMalkovitzch, ddxc, 3ntr0py, GothicLogic, hkevin, Hessesian, flarornEral, suetekh, whisperer, batsbargy, strudels, Rex_Mundi, limited, Rik, hackaday, nmobin27, whoami, Caddyamilla, NIGHTWOLF, dark_void, Cockelala, Xendz, trueorfalse, Klosse, Blavatsky, InjectioN, Bumpadjuppy, DrOptix, blackknight911, Effomeidonize, Distorted, TheHarrisonW, Obop, ellisp, Vreality2007, advenlydent, zach, Vengeance987, m0rt, 2345, electro-technic, riesenjoe, IvanDimitriev, RomeoG, timetrust, 2142, BillTuer, advilapyday, lotato, lonely.connection, CloverCipher, vnd, aurena, rospark, valy1177, learning, st3alth, Partisan, K0gller, fitz, Jayjay, psychomarine, Vspectrum, San Marino, TinCardinal, brunoriversyhn, code-g, yshiau, Psiber_Syn, Seasharp, obencefoozy, SlayingDragons, Link-, tinuigimeni, jasonbourne, Fred, somebody777, Meonkzt, CJ_Omaha, jearrorne, cls777, unsugsNashy, Balksnuntails, Sir D. Naut, Macabre, Nightraven, Iccyx, Repuhlsive, vipervince2002, Janomatrix, lol, veceattainc, techno, Exclaw, Nikhil, evjfvir967nj, Mod777, nermtode, Tjm, bjy1997, hecky, saraf, elprof, damoniceht, trik, jordan86, SnoopSky, dan_movie, OnetInsolefon, darkfire1515, seojlhmyrhwh, Thoplehap, MaxMeier, 1028rajeev, Abhinav2107, autotuneuser, alexelixir, Tauya, Jozinbrejl, kernel_mod, quolc, anandoump, vladavlada, Taicadine, AnnaNoult, GreenTiger, baripadatimes, Ewing, Blackbeard, thepuppeteer, BON-SELE, hak4r, Unotohumsmush, m4f10, avacraft, becool, thecoder, n01se, alpha1, saki, ObesseJew, ActictGlync, sajan, unicornrainbow, Domihoolbob, matt.14, max66, SnowFury, Spud101, myfabregas, Ausome1, kajman121, Frudopvia, ideveloper6, OLOLO, Bugshuppy, lamb, VagWirura, LialiTiTviors, Ordeptpen, scifics, Pozycj-Z21, Gkjt, interPuscruse, aaftab, TheCheeseDemon, blackcyxx21, jollyjimbo, N4g4c3N, rineDriekly, Rap70r, Xargos, ovetz13, sonu sahu, Breezy, emitleBen, Hackpad, JWTSR, nicyun, kaizo, itevainee, luke460, AverageJoe, zeratu92, litbk, Mr.Pickle, mannavard1611, LoopyLion, NexusVos, mtroscheck, burberrybagsjr, nikedunksxm, xordux, jeho, Lonewolf034, Dragonite, nhorton, Reloaded, Odile, Kaptain_k1rk, Teefelltugh, grizzly, posthuman01, jakesboy2, pwnpwnlolz, Sabo, Lakhoamnmek, Røgue, dot_Cipher, mori, snickerless1, cart1m, KELATALFTUS, hubris, Afrika, welepocourl, carpinteyrofbt, ReottphoffBom, Reahastegah, pumashoesld, pdanielt, dmac006, DnA-Ender, Red Fox, couptupleakb, ryanjcrook, iMaxx, sh3llcod3, TimHortons, EmilaHapsaums, Feld Grau, burgeoningneophyte, Maroonhat, CookieAu, tinkansinar, Mitodina, timberlandoutletlufc, zsefvy, guccioutletox, AlexDiru, AbercrombieFitchhl, Ryuske, r0z4, slchill, kalak55, Ph4Kt480ii, beefarn, Jigoku, WrossyJes, pollolololo, ZepSung, Fragility, jell0, C9019, Othrguy, Noticon, KIKNWING, llasarus, mdubz, leah027, iellswo, MAZI_, Estilaamoli, subtentar, Trollorful, no |
| |
|
|
|
|
|