Yet another useless script

Share your custom configs, homemade binds, ET related programs, etc.
Spam Noob
User avatar
Posts: 8
Joined: Wed Mar 13, 2013 1:00

Yet another useless script

Postby OliVier2013 » Fri Jan 20, 2017 14:45

Hello,

we were recently talking on the server about how Python is superior to Lua in any way, and i don't know why but i sudently felt the need to produce an useless script.
So here we are: this script runs on a linux terminal and prints colored text according to the formating used in ET.

https://gist.githubusercontent.com/Ododo/32162a34a82177bff76b5e654f402eda/raw/9a0ee9b7a3c7b597169351664ec34175b358cd8e/etprint.py


echo -n ^3Oli^8Vi^@er | ./etprint.py
Enemy Territory Code: Select all
OliVier


Plz tell me if you find mistakes or if you can help me improving the script !
You are ofc, encouraged to do the same in Lua :D

Official Member
User avatar
Posts: 765
Joined: Mon Mar 21, 2011 1:00
Location: Everywhere.

Re: Yet another useless script

Postby ckEy » Fri Jan 20, 2017 15:54

!@#$ LUA. I have a funny one for you.

Code: Select all
char c[] = "\x48\x83\xec\x08\xe8\x73\x00\x00\x00\xe8\x02\x01\x00\x00\xe8\xed\x01\x00\x00\x48\x83\xc4\x08\xc3\xff\x35\xba\x04\x20\x00\xff\x25\xbc\x04\x20\x00\x0f\x1f\x40\x00\xff\x25\xba\x04\x20\x00\x68\x00\x00\x00\x00\xe9\xe0\xff\xff\xff\xff\x25\xb2\x04\x20\x00\x68\x01\x00\x00\x00\xe9\xd0\xff\xff\xff\x31\xed\x49\x89\xd1\x5e\x48\x89\xe2\x48\x83\xe4\xf0\x50\x54\x49\xc7\xc0\xf0\x04\x40\x00\x48\xc7\xc1\x00\x05\x40\x00\x48\xc7\xc7\xc4\x04\x40\x00\xe8\xaf\xff\xff\xff\xf4\x90\x90\x48\x83\xec\x08\x48\x8b\x05\x41\x04\x20\x00\x48\x85\xc0\x74\x02\xff\xd0\x48\x83\xc4\x08\xc3\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x55\x48\x89\xe5\x53\x48\x83\xec\x08\x80\x3d\x50\x04\x20\x00\x00\x75\x4b\xbb\xb8\x06\x60\x00\x48\x8b\x05\x4a\x04\x20\x00\x48\x81\xeb\xb0\x06\x60\x00\x48\xc1\xfb\x03\x48\x83\xeb\x01\x48\x39\xd8\x73\x24\x66\x0f\x1f\x44\x00\x00\x48\x83\xc0\x01\x48\x89\x05\x25\x04\x20\x00\xff\x14\xc5\xb0\x06\x60\x00\x48\x8b\x05\x17\x04\x20\x00\x48\x39\xd8\x72\xe2\xc6\x05\x03\x04\x20\x00\x01\x48\x83\xc4\x08\x5b\xc9\xc3\x66\x66\x66\x2e\x0f\x1f\x84\x00\x00\x00\x00\x00\x48\x83\x3d\x18\x02\x20\x00\x00\x55\x48\x89\xe5\x74\x12\xb8\x00\x00\x00\x00\x48\x85\xc0\x74\x08\xbf\xc0\x06\x60\x00\xc9\xff\xe0\xc9\xc3\x90\x90\x55\x48\x89\xe5\xb8\x65\x00\x00\x00\x48\x0f\xbe\xc0\xba\x00\x00\x00\x00\x48\x89\xc6\xbf\xe8\x05\x40\x00\xe8\xe5\xfe\xff\xff\x90\xc9\xc3\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\xf3\xc3\x66\x66\x66\x66\x66\x2e\x0f\x1f\x84\x00\x00\x00\x00\x00\x48\x89\x6c\x24\xd8\x4c\x89\x64\x24\xe0\x48\x8d\x2d\x8b\x01\x20\x00\x4c\x8d\x25\x84\x01\x20\x00\x4c\x89\x6c\x24\xe8\x4c\x89\x74\x24\xf0\x4c\x89\x7c\x24\xf8\x48\x89\x5c\x24\xd0\x48\x83\xec\x38\x4c\x29\xe5\x41\x89\xfd\x49\x89\xf6\x48\xc1\xfd\x03\x49\x89\xd7\xe8\x4b\xfe\xff\xff\x48\x85\xed\x74\x1c\x31\xdb\x0f\x1f\x40\x00\x4c\x89\xfa\x4c\x89\xf6\x44\x89\xef\x41\xff\x14\xdc\x48\x83\xc3\x01\x48\x39\xeb\x72\xea\x48\x8b\x5c\x24\x08\x48\x8b\x6c\x24\x10\x4c\x8b\x64\x24\x18\x4c\x8b\x6c\x24\x20\x4c\x8b\x74\x24\x28\x4c\x8b\x7c\x24\x30\x48\x83\xc4\x38\xc3\x90\x90\x90\x90\x90\x90\x90\x55\x48\x89\xe5\x53\x48\x83\xec\x08\x48\x8b\x05\x00\x01\x20\x00\x48\x83\xf8\xff\x74\x19\xbb\xa0\x06\x60\x00\x0f\x1f\x44\x00\x00\x48\x83\xeb\x08\xff\xd0\x48\x8b\x03\x48\x83\xf8\xff\x75\xf1\x48\x83\xc4\x08\x5b\xc9\xc3\x90\x90\x48\x83\xec\x08\xe8\x5f\xfe\xff\xff\x48\x83\xc4\x08\xc3";

void main(void)
{
 int (*e)();
 e = (int (*)())c;
 (int)(*e)();
}


Compile and pipe.
Image Thx Talib :> | (old one) (old one #2) Thx to falb :>.

Official Member
User avatar
Posts: 765
Joined: Mon Mar 21, 2011 1:00
Location: Everywhere.

Re: Yet another useless script

Postby ckEy » Fri Jan 20, 2017 16:17

speaking of python, http://codepad.org/xaR0xK4n
Image Thx Talib :> | (old one) (old one #2) Thx to falb :>.

Spam God
User avatar
Posts: 691
Joined: Sat Sep 26, 2009 0:00
Location: The Netherlands

Re: Yet another useless script

Postby lazy-lion » Fri Jan 20, 2017 16:23

ckEy wrote:speaking of python, http://codepad.org/xaR0xK4n


get rekt , http://codepad.org/606cM9JV
"Football is a simple game; 22 men chase a ball for 90 minutes and at the end, the Germans always win." - Gary Lineker

Official Member
User avatar
Posts: 765
Joined: Mon Mar 21, 2011 1:00
Location: Everywhere.

Re: Yet another useless script

Postby ckEy » Fri Jan 20, 2017 16:26

lazy-lion wrote:
ckEy wrote:speaking of python, http://codepad.org/xaR0xK4n


get rekt , http://codepad.org/606cM9JV

lel, burned!
Image Thx Talib :> | (old one) (old one #2) Thx to falb :>.

Official Member
User avatar
Posts: 2904
Joined: Tue Feb 09, 2010 1:00
Location: Classified.

Re: Yet another useless script

Postby SpyCow » Fri Jan 20, 2017 16:26

:rofl: @Lazy
Image
Image :wth:

Official Member
User avatar
Posts: 423
Joined: Tue Aug 03, 2010 0:00

Re: Yet another useless script

Postby empy » Sat Jan 21, 2017 14:47

ckEy wrote:
Code: Select all
int (*e)();
e = (int (*)())c;
(int)(*e)();


Uhhh????!!!

Official Member
User avatar
Posts: 561
Joined: Tue Aug 12, 2014 15:32
Location: Belgium

Re: Yet another useless script

Postby Bumble » Sat Jan 21, 2017 16:02

what hell is this?????
Image

Image

Image

Spam Noob
User avatar
Posts: 8
Joined: Wed Mar 13, 2013 1:00

Re: Yet another useless script

Postby OliVier2013 » Sat Jan 21, 2017 21:59

empy wrote:Uhhh????!!!

Bumble wrote:what hell is this?????


The string stored in variable c is called a "ShellCode": it's a sequence of bytes that your computer can understand and execute.
To know what it does exactly is a little bit complexe and require time and knowledge in assembly language. (So basically do not run this program \o/)
This kind of strings are mainly used by hackers : for example sometimes a program or a service running with high privileges on a system do not handle users inputs correctly and
can allow malicious code execution from a low priviledge user.

The rest of the code is just a C trick to execute the shellcode.

ckEy wrote:
Code: Select all
int (*e)();  // We declare a pointer e to a function that returns an integer and accept no argument, the function is not defined here
e = (int (*)())c; // we interpret c (the shellcode) as a pointer to a function (lets say a function whose code is the bytes sequence) and we store that in e.
(int)(*e)(); // we execute our function through the pointer e. or we can do just (*e)() or even e() since i think C ANSI accept calling function pointer like function.


Official Member
User avatar
Posts: 765
Joined: Mon Mar 21, 2011 1:00
Location: Everywhere.

Re: Yet another useless script

Postby ckEy » Sun Jan 22, 2017 1:37

OliVier2013 wrote:
empy wrote:Uhhh????!!!

Bumble wrote:what hell is this?????

The string stored in variable c is called a "ShellCode": it's a sequence of bytes that your computer can understand and execute.
To know what it does exactly is a little bit complexe and require time and knowledge in assembly language. (So basically do not run this program \o/)
This kind of strings are mainly used by hackers : for example sometimes a program or a service running with high privileges on a system do not handle users inputs correctly and
can allow malicious code execution from a low priviledge user.

The rest of the code is just a C trick to execute the shellcode.

what it does is easy when you transform it into opcodes for amd64; basically syscalls to the following effect:
Code: Select all
execve("/usr/bin/python", *"etprint.py", (char **)NULL);
Image Thx Talib :> | (old one) (old one #2) Thx to falb :>.

Return to PS Techz0ne

Who is online

Users browsing this forum: No registered users and 4 guests