Videos
I want to create a Python IDE using Django and JavaScript. I am facing an issue with taking user input when using the exec or eval functions in Python.
After further research, I came across subprocess and IPython, which seem like they could be used to create what I want, but I am still not very confident. Could you please suggest how to create a Python IDE using these tools or any other?
code = "print('Hello, my name is')\nk = input('Enter your name')\nprint(k)"
exec(code)when i run the above code in the vs code by terminal then its
Hello, my name is Enter your name
but when i run in Django then i didn't get
how to achieve same with Django?
code data will come from frontend.
I am posting this both on r/Assembly_Language and here. I think the topic involves both fairly strongly.
So, I am going to do a presentation involving buffer overflows and I learned some basic Assembly because of that (more specifically the function prologue). I plan on learning Assembly for real and have installed SASM, but for now I just know basic C. I need help reading something.
In one of my sources (https://www.tenouk.com/Bufferoverflowc/Bufferoverflow4.html), this guy does disass in his vulnerable function in order to show that sub has allocated more space than he declared (4 vs 20).
This is his code:
#include <unistd.h>
void Test()
{
char buff[4];
printf("Some input: ");
gets(buff);
puts(buff);
}
int main(int argc, char *argv[ ])
{
Test();
return 0;
}And this is the output of disass Test:
0x080483d0 <Test+0>: push %ebp 0x080483d1 <Test+1>: mov %esp, %ebp 0x080483d3 <Test+3>: sub $0x8, %esp 0x080483d6 <Test+6>: sub $0xc, %esp
Buff is 4 bytes and 20 bytes are "freed" on the stack. But when I try to do the same with a relatively more complicated function (I hope commentary is enough for the language gap):
#include <stdio.h>
#include <string.h>
#include <locale.h>
#include <stdlib.h>
void senha(){
char senha[10];
char senhareal[10]="dddddd";
int teste = 0;
char resposta[3];
printf("\n\n\n\n-----------------------------SISTEMA NUCLEAR DA OTAN------------------------------------ \n\n\n\n");
printf("DIGITE SUA SENHA: ");
gets(senha);
if(0 == strncmp(senha, senhareal, 20))
{
printf ("\nSenha correta! \n");
teste = 1;
}
else
{
printf ("\nSENHA INCORRETA! \n");
}
if(teste)
{
printf ("\nO usuário agora controla a instalação! Deseja destruir o Brasil? \n");
gets(resposta);
}
}
int main(){
system("color 03");
setlocale(LC_ALL, "Portuguese");
senha();
return 0;
}I get this:
0x0000555555555209 <+0>: endbr64 0x000055555555520d <+4>: push %rbp 0x000055555555520e <+5>: mov %rsp,%rbp 0x0000555555555211 <+8>: sub $0x30,%rsp 0x0000555555555215 <+12>: mov %fs:0x28,%rax 0x000055555555521e <+21>: mov %rax,-0x8(%rbp)
No matter my input. So why does Online GDB consistently subtract 48 bytes? What are the instructions following sub and do they apply at all to what I am trying to do? Is it possible to know what's going on in that specific platform? Finally, am I unable to replicate what this person did with my code?
I tested the code of my source in Online GDB as well. It consistently subtracts 16 bytes.
The code is extremely sloppy, I'm just trying to get my program to work. After half an hour of trying to figure out why 2 strings that were exactly the same in the expression string1==string2 had it evaluating to 0, I tried another compiler. It worked there. Why is GDB doing this?