Skip to content

Commit

Permalink
TMP
Browse files Browse the repository at this point in the history
  • Loading branch information
gogo2464 committed Dec 13, 2023
1 parent 58ec4a4 commit 368cc4d
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 69 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/Testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,22 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Install swig

- uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Install dependencies
run: |
choco install python --version=3.8.0
choco install --yes swig
- name: Build
run: make all
run: |
make all PYENV=C:\hostedtoolcache\windows\Python\3.8.10\x64
- name: Run Tests
run: |
make all ;
make all PYENV=C:\hostedtoolcache\windows\Python\3.8.10\x64
python -c "from pwnlib.tubes import process; process.send()"
- name: Clean
- name: Clean
run: make clean

ubuntu-testing:
Expand Down
43 changes: 0 additions & 43 deletions .github/workflows/Windows.yml

This file was deleted.

9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
CC=clang
CFLAGS=-W -Wall -ansi -pedantic -std=c99 -g
INC=-I include/
SRC=src/

CFLAGS=-W -Wall -ansi -pedantic -std=c99 -g
PYENV?=C:\Python38

all:
$(MAKE) -C pwnlib

clean:
$(MAKE) -C pwnlib clean
$(MAKE) -C pwnlib clean
5 changes: 3 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ As the dev have some experience with the old pwntools, the new tool aims to fix
# I.1 Install building dependencies

```
choco install --yes python --version 3.8.0
choco install --yes swig
```

# I.2 Build/Clean project

build with
In order to build pwnto-driver including swig bindings, you must specify your python path. For example, if you installed python 3 with the command `choco install --yes python --version 3.8.0`, the you could build with:

```shell
make all
make all PYENV=C:\Python38
```
clean with

Expand Down
2 changes: 1 addition & 1 deletion pwnlib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ all:
$(MAKE) -C tubes

clean:
$(MAKE) -C tubes clean
$(MAKE) -C tubes clean
12 changes: 6 additions & 6 deletions pwnlib/tubes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ all: swig-all
swig-all:
swig -python process.i
gcc -O2 -fPIC -c process.c
gcc -O2 -fPIC -c process_wrap.c -I C:\Python38\include
gcc -shared process.o process_wrap.o -o _process.pyd -L C:\Python38\libs -l python3
gcc -O2 -fPIC -c process_wrap.c -I"$(PYENV)\include"
gcc -shared process.o process_wrap.o -o _process.pyd -L "$(PYENV)\libs" -l python3

clean:
del process.o
del process_wrap.o
del process.py
del _process.pyd
@rm process.o
@rm process_wrap.o
@rm process.py
@rm _process.pyd


#clang -shared -o process.dll -IC:\Python38\include process.c process_wrap.c -LC:\Python38\libs\python38.lib -lpython3#clang -shared -o process.dll -IC:\Python38\include process.c process_wrap.c -LC:\Python38\libs\python38.lib -lpython3
2 changes: 2 additions & 0 deletions pwnlib/tubes/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include <stdlib.h>
#include "process.h"

Process proc;

void process (char *command) {
/**
* @brief open a file.
Expand Down
2 changes: 0 additions & 2 deletions pwnlib/tubes/process.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ typedef struct {
FILE *process_PID;
} Process;

Process proc;

void process (char *command);
void recv(int size);
void send();
Expand Down
6 changes: 1 addition & 5 deletions pwnlib/tubes/process.i
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
%module process
%{
#ifdef _MSC_VER
#define SWIG_PYTHON_INTERPRETER_NO_DEBUG
#endif

#include "process.h"
%}

void send();
%include "process.h"

0 comments on commit 368cc4d

Please sign in to comment.