Skip to content

Commit

Permalink
Misc
Browse files Browse the repository at this point in the history
  • Loading branch information
hupe1980 committed Aug 22, 2021
1 parent f39f236 commit 53258c5
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ before:
- go mod tidy
- ./scripts/completions.sh
builds:
- dir: cmd
- skip: true
dir: cmd
env:
- CGO_ENABLED=0
goos:
Expand Down
7 changes: 2 additions & 5 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ Vagrant.configure("2") do |config|
apt-get update && apt-get upgrade -y
apt-get install golang-go make cmake gcc gcc-multilib g++-multilib gdb checksec -y
sh /home/vagrant/gopwn/scripts/install_capstone.sh
sh /home/vagrant/gopwn/scripts/install_keystone.sh
echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig
/home/vagrant/gopwn/scripts/install_capstone.sh
/home/vagrant/gopwn/scripts/install_keystone.sh
SHELL
end
4 changes: 2 additions & 2 deletions elf.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ func (e *ELF) Canary() bool {
// NX checks whether the current binary uses NX protections
func (e *ELF) NX() bool {
for _, prog := range e.file.Progs {
if uint32(prog.Type) == uint32(0x6474e551) { // PT_GNU_STACK
if (uint32(prog.Flags) & uint32(elf.PF_X)) == 0 {
if prog.Type == elf.PT_GNU_STACK {
if prog.Flags&elf.PF_X == 0 {
return true
}
}
Expand Down
9 changes: 9 additions & 0 deletions rop.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package gopwn

type GadgetType int

const (
GADGET_TYPE_ROP GadgetType = iota
GADGET_TYPE_JOP
GADGET_TYPE_SYS
)
3 changes: 2 additions & 1 deletion scripts/install_capstone.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/bash

CS_VERSION=4.0.2

Expand All @@ -12,4 +12,5 @@ cd ./capstone
make
make install

cd $HOME
rm -rf /tmp/capstone
8 changes: 4 additions & 4 deletions scripts/install_keystone.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/bash

KS_VERSION=0.9.2

Expand All @@ -11,14 +11,14 @@ mv ./keystone-${KS_VERSION} ./keystone
cd ./keystone
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -D BUILD_LIBS_ONLY=1 -DBUILD_SHARED_LIBS=ON -G "Unix Makefiles" ..
cmake -DCMAKE_BUILD_TYPE=Release -D BUILD_LIBS_ONLY=1 -DBUILD_SHARED_LIBS=OFF -G "Unix Makefiles" ..
make -j8
make install

cd $HOME
rm -rf /tmp/keystone

# Keystone is installed in /usr/local, depending on your distribution (eg. Ubuntu) you might need to add /usr/local/lib to /etc/ld.so.conf.
if [ $(awk -F= '/^ID=/{print $2}' /etc/os-release) == "ubuntu" ]; then
echo "/usr/local/lib" >> /etc/ld.so.conf
if [[ "$(awk -F= '/^ID=/{print $2}' /etc/os-release)" == "ubuntu" ]]; then
ldconfig
fi

0 comments on commit 53258c5

Please sign in to comment.