Showing posts with label Segurança. Show all posts
Showing posts with label Segurança. Show all posts

Friday, July 17, 2020

Well Done Explanation of XSS (Cross-site-scripting)

Recommended reading about how XSS works, how to avoid this kind of attack.

https://excess-xss.com/


Thursday, February 27, 2020

SSH Proxy SOCKS - Raspbian / Chromium

alias proxy.on='ssh -D 1337 -q -C -N myuser@mysshserver';
alias chromium.proxy='chromium-browser --proxy-server="socks5://localhost:1337" --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE localhost"';

Tuesday, March 6, 2018

Tcpdump

TCP Dump
----------------------------------------------------------------------------------
$ sudo tcpdump -s 0 -A host www.uol.com.br and port 80 #Show ASCII
$ sudo tcpdump -s 0 -X host www.uol.com.br and port 80 #Show Hexdump and ASCII

#Filter only packages in port range from 4210-4218, with tcp-flag Push, and do not buffer output with "-l" so I can pipe and don't freeze

$ sudo tcpdump -l -i eth0 -X -s 0 -n 'host snelnxa124 and portrange 4210-4218 and (tcp[tcpflags] & (tcp-push) != 0)'
$ sudo tcpdump -l -i eth0 -A -s 0 -n 'host snelnxa124 and portrange 4210-4218 and (tcp[tcpflags] & (tcp-push) != 0)' | grep -v Flags
$ sudo tcpdump -l -i eno1  -A -s 0 -n 'host www.ic.unicamp.br and tcp port http'

Extra
-----------------------------------------------------------------------------------
$ telnet towel.blinkenlights.nl #Star wars ascii

https://goo.gl/AwpNxV
https://fwknowledge.wordpress.com/2013/03/05/tcpdump-flags/
https://www.wains.be/pub/networking/tcpdump_advanced_filters.txt

Monday, May 22, 2017

Encrypt with password in C

 crypt, crypt_r - password and data encryption

SYNOPSIS
       #define _XOPEN_SOURCE       /* See feature_test_macros(7) */
       #include

       char *crypt(const char *key, const char *salt);

       #define _GNU_SOURCE         /* See feature_test_macros(7) */
       #include

       char *crypt_r(const char *key, const char *salt,
                     struct crypt_data *data);

       Link with -lcrypt.



 encrypt, setkey, encrypt_r, setkey_r - encrypt 64-bit messages

SYNOPSIS
       #define _XOPEN_SOURCE       /* See feature_test_macros(7) */
       #include

       void encrypt(char block[64], int edflag);

       #define _XOPEN_SOURCE       /* See feature_test_macros(7) */
       #include

       void setkey(const char *key);

       #define _GNU_SOURCE         /* See feature_test_macros(7) */
       #include

       void setkey_r(const char *key, struct crypt_data *data);
       void encrypt_r(char *block, int edflag, struct crypt_data *data);

       Each of these requires linking with -lcrypt.
 

Password protect file with GNU OpenGPG

Encrtypt
$ gpg -e filename  -o protectedfilename.gpg

This will prompt for password

Decrypt
gpg protectedfilename.gpg

or

gpg -d protectedfilename.gpg > filename

Wednesday, March 10, 2010

Buffer Overflow

Tutorial bem didático e detalhado explicando a estrutura e o funcionamento de um programa em C.

Smashing the stack by
Aleph One

Download Clique Aqui

http://www.phrack.com/issues.html?issue=49&id=14

Divisão de um programa executável
                             /------------------\  lower
                          |                  |  memory
                          |       Text       |  addresses
                          |                  |
                          |------------------|
                          |   (Initialized)  |
                          |        Data      |
                          |  (Uninitialized) |
                          |------------------|
                          |                  |
                          |       Stack      |  higher
                          |                  |  memory
                          \------------------/  addresses

                      Fig. 1 Process Memory Regions
Buffer overflow consiste em sobrescrever o valor de retorno guardado na pilha apos uma chamada de função e fazer com que se retorne para o endereço onde está o código de um programa que se deseja executar.

Blog Archive