-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from gogo2464/unit-testing
add testing and minimal example
- Loading branch information
Showing
11 changed files
with
189 additions
and
1 deletion.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Testing | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
tags-ignore: | ||
- '*' | ||
pull_request: | ||
|
||
jobs: | ||
windows-testing: | ||
|
||
runs-on: windows-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.8' | ||
|
||
- name: Install dependencies | ||
run: | | ||
choco install --yes swig | ||
- name: Build | ||
run: | | ||
make all PYENV=C:\hostedtoolcache\windows\Python\3.8.10\x64 | ||
- name: Run Tests | ||
run: | | ||
make all PYENV=C:\hostedtoolcache\windows\Python\3.8.10\x64 | ||
python -c "from pwnlib.tubes import process; process.send()" | ||
- name: Clean | ||
run: make clean | ||
|
||
ubuntu-testing: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install swig | ||
run: | | ||
sudo apt install --yes swig | ||
- name: Build | ||
run: echo "hello world" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CC=clang | ||
CFLAGS=-W -Wall -ansi -pedantic -std=c99 -g | ||
PYENV?=C:\Python38 | ||
|
||
all: | ||
$(MAKE) -C pwnlib | ||
|
||
clean: | ||
$(MAKE) -C pwnlib clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CC=clang | ||
CFLAGS=-W -Wall -ansi -pedantic -std=c99 -g | ||
|
||
all: | ||
$(MAKE) -C tubes | ||
|
||
clean: | ||
$(MAKE) -C tubes clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
CC=clang | ||
CFLAGS=-W -Wall -ansi -pedantic -std=c99 -g | ||
INC=-I include/ | ||
|
||
all: swig-all | ||
|
||
swig-all: | ||
swig -python process.i | ||
gcc -O2 -fPIC -c process.c | ||
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: | ||
@rm process.o | ||
@rm process_wrap.o | ||
@rm process.py | ||
@rm _process.pyd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include "process.h" | ||
|
||
Process proc; | ||
|
||
void process (char *command) { | ||
/** | ||
* @brief open a file. | ||
* | ||
* @param file , the file to execute. | ||
* @return Nothing. | ||
* | ||
* @test | ||
* File * fdesc = process("python"); | ||
* //CHECK(p.recv(5) == "Hello"); | ||
*/ | ||
|
||
|
||
printf("hello\n"); | ||
} | ||
|
||
void recv(int size) { | ||
char *buff; | ||
fgets(buff, sizeof(size), proc.process_PID); | ||
} | ||
|
||
void send () { | ||
printf("hey!"); | ||
} | ||
|
||
void libs() { | ||
|
||
} | ||
|
||
void libc() { | ||
|
||
} | ||
|
||
void bin() { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
typedef struct { | ||
FILE *process_PID; | ||
} Process; | ||
|
||
void process (char *command); | ||
void recv(int size); | ||
void send(); | ||
void libs(); | ||
void libc(); | ||
void bin(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
%module process | ||
%{ | ||
#include "process.h" | ||
%} | ||
|
||
%include "process.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include "process.h" | ||
|
||
void function init_all() { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
void function init_all(); |