Convert simple HelloWorld.c (C) in Assembly(AT&T)

Convert simple HelloWorld.c (C) in Assembly(AT&T)

C:

#gcc helloworld.c -o helloworld

/* Hello World program */
#include<stdio.h>
main()
{
printf(“Hello World”);
}

Assembly (AT&T)

#gcc -O3 -S -masm=intel -mtune=native -fverbose-asm helloworld.c

Assembly:

.file “helloworld.c”
.intel_syntax noprefix
# GNU C11 (GCC) version 5.1.1 20150618 (Red Hat 5.1.1-4) (x86_64-redhat-linux)
# compiled by GNU C version 5.1.1 20150618 (Red Hat 5.1.1-4), GMP version 6.0.0, MPFR version 3.1.2, MPC version 1.0.2
# warning: MPFR header version 3.1.2 differs from library version 3.1.3.
# GGC heuristics: –param ggc-min-expand=100 –param ggc-min-heapsize=131072
# options passed: helloworld.c –param l1-cache-size=32
# –param l1-cache-line-size=64 –param l2-cache-size=4096 -mtune=haswell
# -masm=intel -march=x86-64 -O3 -fverbose-asm
# options enabled: -faggressive-loop-optimizations -falign-labels
# -fasynchronous-unwind-tables -fauto-inc-dec -fbranch-count-reg
# -fcaller-saves -fchkp-check-incomplete-type -fchkp-check-read
# -fchkp-check-write -fchkp-instrument-calls -fchkp-narrow-bounds
# -fchkp-optimize -fchkp-store-bounds -fchkp-use-static-bounds
# -fchkp-use-static-const-bounds -fchkp-use-wrappers
# -fcombine-stack-adjustments -fcommon -fcompare-elim -fcprop-registers
# -fcrossjumping -fcse-follow-jumps -fdefer-pop
# -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively
# -fdwarf2-cfi-asm -fearly-inlining -feliminate-unused-debug-types
# -fexpensive-optimizations -fforward-propagate -ffunction-cse -fgcse
# -fgcse-after-reload -fgcse-lm -fgnu-runtime -fgnu-unique
# -fguess-branch-probability -fhoist-adjacent-loads -fident -fif-conversion
# -fif-conversion2 -findirect-inlining -finline -finline-atomics
# -finline-functions -finline-functions-called-once
# -finline-small-functions -fipa-cp -fipa-cp-alignment -fipa-cp-clone
# -fipa-icf -fipa-icf-functions -fipa-icf-variables -fipa-profile
# -fipa-pure-const -fipa-ra -fipa-reference -fipa-sra -fira-hoist-pressure
# -fira-share-save-slots -fira-share-spill-slots
# -fisolate-erroneous-paths-dereference -fivopts -fkeep-static-consts
# -fleading-underscore -flifetime-dse -flra-remat -flto-odr-type-merging
# -fmath-errno -fmerge-constants -fmerge-debug-strings
# -fmove-loop-invariants -fomit-frame-pointer -foptimize-sibling-calls
# -foptimize-strlen -fpartial-inlining -fpeephole -fpeephole2
# -fpredictive-commoning -fprefetch-loop-arrays -free -freg-struct-return
# -freorder-blocks -freorder-blocks-and-partition -freorder-functions
# -frerun-cse-after-loop -fsched-critical-path-heuristic
# -fsched-dep-count-heuristic -fsched-group-heuristic -fsched-interblock
# -fsched-last-insn-heuristic -fsched-rank-heuristic -fsched-spec
# -fsched-spec-insn-heuristic -fsched-stalled-insns-dep -fschedule-fusion
# -fschedule-insns2 -fsemantic-interposition -fshow-column -fshrink-wrap
# -fsigned-zeros -fsplit-ivs-in-unroller -fsplit-wide-types -fssa-phiopt
# -fstdarg-opt -fstrict-aliasing -fstrict-overflow
# -fstrict-volatile-bitfields -fsync-libcalls -fthread-jumps
# -ftoplevel-reorder -ftrapping-math -ftree-bit-ccp -ftree-builtin-call-dce
# -ftree-ccp -ftree-ch -ftree-coalesce-vars -ftree-copy-prop
# -ftree-copyrename -ftree-cselim -ftree-dce -ftree-dominator-opts
# -ftree-dse -ftree-forwprop -ftree-fre -ftree-loop-distribute-patterns
# -ftree-loop-if-convert -ftree-loop-im -ftree-loop-ivcanon
# -ftree-loop-optimize -ftree-loop-vectorize -ftree-parallelize-loops=
# -ftree-partial-pre -ftree-phiprop -ftree-pre -ftree-pta -ftree-reassoc
# -ftree-scev-cprop -ftree-sink -ftree-slp-vectorize -ftree-slsr -ftree-sra
# -ftree-switch-conversion -ftree-tail-merge -ftree-ter -ftree-vrp
# -funit-at-a-time -funswitch-loops -funwind-tables -fverbose-asm
# -fzero-initialized-in-bss -m128bit-long-double -m64 -m80387
# -malign-stringops -mfancy-math-387 -mfp-ret-in-387 -mfxsr -mglibc
# -mieee-fp -mlong-double-80 -mmmx -mno-sse4 -mpush-args -mred-zone -msse
# -msse2 -mtls-direct-seg-refs -mvzeroupper

.section .rodata.str1.1,”aMS”,@progbits,1
.LC0:
.string “Hello World”
.section .text.unlikely,”ax”,@progbits
.LCOLDB1:
.section .text.startup,”ax”,@progbits
.LHOTB1:
.p2align 4,,15
.globl main
.type main, @function
main:
.LFB11:
.cfi_startproc
sub rsp, 8 #,
.cfi_def_cfa_offset 16
mov edi, OFFSET FLAT:.LC0 #,
xor eax, eax #
call printf #
xor eax, eax #
add rsp, 8 #,
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE11:
.size main, .-main
.section .text.unlikely
.LCOLDE1:
.section .text.startup
.LHOTE1:
.ident “GCC: (GNU) 5.1.1 20150618 (Red Hat 5.1.1-4)”
.section .note.GNU-stack,””,@progbits

@firebitsbr

Anúncios

Script install OpenVAS 8, DB Redis and Debian 8.1 (Jessie) x86_64

#!/bin/bash
#OpenVAS 8
#version 8.0.4
#Debian 8.1
#Script
#Mauro Risonho de Paula Assumpção aka firebits mauro.risonho@gmail.com
#11.12.2015 17:51:03

apt-get install -y build-essential devscripts dpatch libassuan-dev libglib2.0-dev libgpgme11-dev libpcre3-dev libpth-dev libwrap0-dev libgmp-dev libgmp3-dev libgpgme11-dev libpcre3-dev libpth-dev quilt cmake pkg-config libssh-dev libglib2.0-dev libpcap-dev libgpgme11-dev uuid-dev bison libksba-dev doxygen sqlfairy xmltoman sqlite3 libsqlite3-dev wamerican redis-server libhiredis-dev libsnmp-dev libmicrohttpd-dev libxml2-dev libxslt1-dev xsltproc libssh2-1-dev libldap2-dev autoconf nmap libgnutls28-dev libpopt-dev heimdal-dev heimdal-multidev libpopt-dev mingw32 texlive-full rpm alien nsis rsync python2.7 python-setuptools

cp /etc/redis/redis.conf /etc/redis/redis.orig
echo “unixsocket /tmp/redis.sock” >> /etc/redis/redis.conf
service redis-server restart

mkdir openvas8
cd openvas8/

wget –no-check-certificate http://wald.intevation.org/frs/download.php/2191/openvas-libraries-8.0.5.tar.gz
wget –no-check-certificate http://wald.intevation.org/frs/download.php/2129/openvas-scanner-5.0.4.tar.gz
wget –no-check-certificate http://wald.intevation.org/frs/download.php/2195/openvas-manager-6.0.6.tar.gz
wget –no-check-certificate http://wald.intevation.org/frs/download.php/2200/greenbone-security-assistant-6.0.6.tar.gz
wget –no-check-certificate http://wald.intevation.org/frs/download.php/2209/openvas-cli-1.4.3.tar.gz
wget –no-check-certificate http://wald.intevation.org/frs/download.php/1975/openvas-smb-1.0.1.tar.gz
wget –no-check-certificate http://wald.intevation.org/frs/download.php/2177/ospd-1.0.2.tar.gz
wget –no-check-certificate http://wald.intevation.org/frs/download.php/2005/ospd-ancor-1.0.0.tar.gz
wget –no-check-certificate http://wald.intevation.org/frs/download.php/2097/ospd-debsecan-1.0.0.tar.gz
wget –no-check-certificate http://wald.intevation.org/frs/download.php/2003/ospd-ovaldi-1.0.0.tar.gz
wget –no-check-certificate http://wald.intevation.org/frs/download.php/2149/ospd-paloalto-1.0b1.tar.gz
wget –no-check-certificate http://wald.intevation.org/frs/download.php/2004/ospd-w3af-1.0.0.tar.gz
wget –no-check-certificate http://wald.intevation.org/frs/download.php/2181/ospd-acunetix-1.0b1.tar.gz
wget –no-check-certificate http://wald.intevation.org/frs/download.php/2185/ospd-ikescan-1.0b1.tar.gz
wget –no-check-certificate http://wald.intevation.org/frs/download.php/2204/ospd-ikeprobe-1.0b1.tar.gz
wget –no-check-certificate http://wald.intevation.org/frs/download.php/2213/ospd-ssh-keyscan-1.0b1.tar.gz
wget –no-check-certificate http://wald.intevation.org/frs/download.php/2219/ospd-netstat-1.0b1.tar.gz

find | grep “.tar.gz$” | xargs -i tar zxvfp ‘{}’

###############################################

cd openvas-smb*
mkdir build
cd build/
cmake ..
make
make doc-full
make install
cd ../../

cd openvas-libraries-*
mkdir build
cd build
cmake ..
make
make doc-full
make install
cd ../../

cd openvas-scanner-*
mkdir build
cd build/
cmake ..
make
make doc-full
make install
cd ../../

cd openvas-manager-*
mkdir build
cd build/
cmake ..
make
make doc-full
make install
cd ../../

cd openvas-cli-*
mkdir build
cd build/
cmake ..
make
make doc-full
make install
cd ../../

cd greenbone-security-assistant-*
mkdir build
cd build/
cat ../src/xslt_i18n.h | sed ‘s///’ > test; cat test > ../src/xslt_i18n.h
cmake ..
make
make doc-full
make install
cd ../../

###

cd ospd-1*
python setup.py install –prefix=/usr/local
cd ../

cd ospd-ancor-*
python setup.py install –prefix=/usr/local
cd ../

cd ospd-debsecan-*
python setup.py install –prefix=/usr/local
cd ../

cd ospd-ovaldi-*
python setup.py install –prefix=/usr/local
cd ../

cd ospd-paloalto-*
python setup.py install –prefix=/usr/local
cd ../

cd ospd-w3af-*
python setup.py install –prefix=/usr/local
cd ../

cd ospd-acunetix-*
python setup.py install –prefix=/usr/local
cd ../

cd ospd-ikescan-*
python setup.py install –prefix=/usr/local
cd ../

cd ospd-ikeprobe-*
python setup.py install –prefix=/usr/local
cd ../

cd ospd-ssh-keyscan-*
python setup.py install –prefix=/usr/local
cd ../

cd ospd-netstat-&
python setup.py install –prefix=/usr/local
cd ../

#reload libraries
ldconfig

###############################################

#create cert
openvas-mkcert
openvas-mkcert-client -n -i

#create user
openvasmd –create-user=admin –role=Admin && openvasmd –user=admin –new-password=admin
#(write down the password)

####

echo ‘#!/bin/bash’ > /usr/local/sbin/openvas-update
echo ‘/usr/local/sbin/openvas-nvt-sync’ >> /usr/local/sbin/openvas-update
echo ‘/usr/local/sbin/openvas-scapdata-sync’ >> /usr/local/sbin/openvas-update
echo ‘/usr/local/sbin/openvas-certdata-sync’ >> /usr/local/sbin/openvas-update
chmod +x /usr/local/sbin/openvas-update

echo ‘#!/bin/bash’ > /usr/local/sbin/openvas-start
echo ‘/usr/local/sbin/openvasmd –rebuild’ >> /usr/local/sbin/openvas-start
echo ‘/usr/local/sbin/openvasmd’ >> /usr/local/sbin/openvas-start
echo ‘/usr/local/sbin/openvassd’ >> /usr/local/sbin/openvas-start
echo ‘/usr/local/sbin/gsad’ >> /usr/local/sbin/openvas-start
chmod +x /usr/local/sbin/openvas-start

echo ‘#!/bin/bash’ > /usr/local/sbin/openvas-kill
echo “ps aux | egrep \”(openvas.d|gsad)\” | awk ‘{print \$2}’ | xargs -i kill ‘{}'” >> /usr/local/sbin/openvas-kill
chmod +x /usr/local/sbin/openvas-kill

rclocal=`cat /etc/rc.local | grep -v “exit 0” | grep -v “openvas”`
echo “$rclocal” > /etc/rc.local
echo “date >> /var/log/openvas_init” >> /etc/rc.local
echo “echo ‘openvas init started’ >> /var/log/openvas_init” >> /etc/rc.local
echo “/usr/local/sbin/openvas-kill >> /var/log/openvas_init || /bin/true” >> /etc/rc.local
echo “/usr/local/sbin/openvas-start >> /var/log/openvas_init || /bin/true” >> /etc/rc.local
echo “echo ‘openvas init finished’ >> /var/log/openvas_init” >> /etc/rc.local
echo “exit 0” >> /etc/rc.local

####

/usr/local/sbin/openvas-kill
/usr/local/sbin/openvas-update
/usr/local/sbin/openvas-start

# check installation
wget https://svn.wald.intevation.org/svn/openvas/trunk/tools/openvas-check-setup –no-check-certificate
chmod 0755 openvas-check-setup
./openvas-check-setup –v8 –server