summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2023-02-04 14:10:26 +0000
committerFreeArtMan <dos21h@gmail.com>2023-02-04 14:10:26 +0000
commit380f0fe40b1ab20790e75dac779e73667cc5ac72 (patch)
tree9fa3b9c93b58c966daa22f955282bc3c181d909a
parentdf881efab146ca3ee61bf8936f948dd976fc4740 (diff)
downloadmd-content-380f0fe40b1ab20790e75dac779e73667cc5ac72.tar.gz
md-content-380f0fe40b1ab20790e75dac779e73667cc5ac72.zip
Update all content to new pygmentize
-rw-r--r--md/notes/undefined_c/tutorial.md4
-rw-r--r--md/writeup/arm64_assembly_crc32.md14
-rw-r--r--md/writeup/arm64_assembly_hello_world.md12
-rw-r--r--md/writeup/basic_http_server.md6
-rw-r--r--md/writeup/bladerf_quick_guide.md1
-rw-r--r--md/writeup/building_openwrt_for_rtl8196c.md12
-rw-r--r--md/writeup/c_bin2hex.md2
-rw-r--r--md/writeup/c_macro_tricks.md37
-rw-r--r--md/writeup/calculate_fir_coefficients_with_c.md4
-rw-r--r--md/writeup/compile_linux_kernel.md22
-rw-r--r--md/writeup/compile_python.md23
-rw-r--r--md/writeup/cve_2010_1160_exploiting_nano.md8
-rw-r--r--md/writeup/datamatch.md10
-rw-r--r--md/writeup/devices/samsung_xe303c12.md24
-rw-r--r--md/writeup/dsp_lp_filter.md10
-rw-r--r--md/writeup/elf_rewrite_function.md16
-rw-r--r--md/writeup/elf_text_section.md4
-rw-r--r--md/writeup/embedding_lua_in_c.md2
-rw-r--r--md/writeup/fpu_catch_division_by_zero.md2
-rw-r--r--md/writeup/gcc_inline_assembly.md16
-rw-r--r--md/writeup/h64e.md14
-rw-r--r--md/writeup/hooking_interrupt_descriptor_table.md7
-rw-r--r--md/writeup/ihe.md2
-rw-r--r--md/writeup/kconf2h.md6
-rw-r--r--md/writeup/kconfig2h_utility.md2
-rw-r--r--md/writeup/kernel_debug_messages.md12
-rw-r--r--md/writeup/kernel_dev_hwrng.md30
-rw-r--r--md/writeup/kernel_hello_world.md8
-rw-r--r--md/writeup/linux_antidebug_5.md2
-rw-r--r--md/writeup/linux_format_string_attack.md24
-rw-r--r--md/writeup/linux_local_descriptor_table.md8
-rw-r--r--md/writeup/linux_shellcode.md8
-rw-r--r--md/writeup/makefile_tips.md16
-rw-r--r--md/writeup/making_c_executables_smaller.md10
-rw-r--r--md/writeup/multiboot_usb_drive.md14
-rw-r--r--md/writeup/openwrt_dependency_graph_drawing.md12
-rw-r--r--md/writeup/qemu_usage.md6
-rw-r--r--md/writeup/radiola.md8
-rw-r--r--md/writeup/rtlsdr_usage.md41
-rw-r--r--md/writeup/running_disk_images_in_qemu.md22
-rw-r--r--md/writeup/scan_memory_for_variable.md18
-rw-r--r--md/writeup/serial_gps_data_reading_utility.md14
-rw-r--r--md/writeup/swift_ocr_example.md2
-rw-r--r--md/writeup/using_iptables.md48
-rw-r--r--md/writeup/wasm_fractal.md4
-rw-r--r--md/writeup/web_assembly_audio_with_fir_filter.md12
-rw-r--r--md/writeup/webusb_example.md20
47 files changed, 300 insertions, 299 deletions
diff --git a/md/notes/undefined_c/tutorial.md b/md/notes/undefined_c/tutorial.md
index 731d42c..3369f6f 100644
--- a/md/notes/undefined_c/tutorial.md
+++ b/md/notes/undefined_c/tutorial.md
@@ -1637,8 +1637,6 @@ rustc main.rs -l lib -L . -o hello -C link-arg="-Wl,-rpath=./"
-```c
-```
### AArch64
@@ -1652,7 +1650,7 @@ Add bin directory location to env variable PATH
export PATH=$PATH:`pwd`
```
-___main.c__
+__main.c__
```c
#include <stdio.h>
diff --git a/md/writeup/arm64_assembly_crc32.md b/md/writeup/arm64_assembly_crc32.md
index 48ffd21..f177f3b 100644
--- a/md/writeup/arm64_assembly_crc32.md
+++ b/md/writeup/arm64_assembly_crc32.md
@@ -18,14 +18,16 @@ With Raspberry Pi 4 need to run it with 64bit linux.
### Raspberry Pi 4
Run command
-```
+
+```bash
uname -a
Linux raspberrypi 5.4.42-v8+ #1319 SMP PREEMPT Wed May 20 14:18:56 BST 2020 aarch64 GNU/Linux
```
There is substring "aarch64" that indicates that os supports 64 bits
To check if CPU supports crc32 instructions run
-```
+
+```bash
cat /proc/cpuinfo | grep crc
```
search for "crc32" substring
@@ -34,12 +36,12 @@ search for "crc32" substring
If you have Apple M1 then you already know it. If not sure run one of those commands to verify archirecture
-```
+```bash
uname -a
```
or
-```
+```bash
arch
```
@@ -228,13 +230,13 @@ int main() {
### Raspbery Pi 4
Need to set extra *-march* option to enable architecture variant that supports crc.
-```
+```bash
gcc asm_crc32.c -o asm_crc32 -march=armv8.1-a
```
### Apple M1
Works without extra options
-```
+```bash
gcc asm_crc32.c -o asm_crc32
```
diff --git a/md/writeup/arm64_assembly_hello_world.md b/md/writeup/arm64_assembly_hello_world.md
index 118e7b6..c4685f1 100644
--- a/md/writeup/arm64_assembly_hello_world.md
+++ b/md/writeup/arm64_assembly_hello_world.md
@@ -25,12 +25,12 @@ int main() {
Running 64bit linux. To detect with architecture and what bitness of
os run command
-```
+```bash
uname
```
Architecture shown as aarch64 enoughs to indicate that os ir 64bit
-```
+```bash
Linux raspberrypi 5.4.42-v8+ #1319 SMP PREEMPT Wed May 20 14:18:56 BST 2020 aarch64 GNU/Linux
```
@@ -65,9 +65,9 @@ _start:
Too compile check if you have installed gnu gcc, other compilers such as clang also
should work perfectly fine.
-```makefile
- as hello.s -o hello.o
- gcc hello.o -o hello
+```bash
+as hello.s -o hello.o
+gcc hello.o -o hello
```
## Apple M1
@@ -97,7 +97,7 @@ helloworld_len = . - helloworld
Install xcode tools before compilation
-```makefile
+```bash
as -o hello.o hello.s
ld -macosx_version_min 11.0.0 -o hello hello.o -lSystem -syslibroot `xcrun -sdk macosx --show-sdk-path` -e _start -arch arm64
```
diff --git a/md/writeup/basic_http_server.md b/md/writeup/basic_http_server.md
index cd1b4de..249c390 100644
--- a/md/writeup/basic_http_server.md
+++ b/md/writeup/basic_http_server.md
@@ -4,17 +4,17 @@ keywords:c,http,server
# Basic HTTP server
Basic HTTP server. When you type url it shows listing of your local directory. If you tipe with path to file name noting hapens
Use:
-```
+```sh
http://*.*.*.*:<port>/ -> disk start directory
http://*.*.*.*:<port>/home/ -> home directory
```
Run:
-```
+```sh
./server [port]
```
Compile:
-```
+```sh
gcc server.c -o server
```
diff --git a/md/writeup/bladerf_quick_guide.md b/md/writeup/bladerf_quick_guide.md
index 1ece22e..dec8ef7 100644
--- a/md/writeup/bladerf_quick_guide.md
+++ b/md/writeup/bladerf_quick_guide.md
@@ -104,7 +104,6 @@ create FM radio listening design and as result you can hear to your local radio
![BladerRF fm radio block diagram](/img/gnuradio/bladerf_fm_radio.png)
-
## Links
[https://www.nuand.com/bladerf-2-0-micro/](https://www.nuand.com/bladerf-2-0-micro/)
diff --git a/md/writeup/building_openwrt_for_rtl8196c.md b/md/writeup/building_openwrt_for_rtl8196c.md
index e3825d7..284b025 100644
--- a/md/writeup/building_openwrt_for_rtl8196c.md
+++ b/md/writeup/building_openwrt_for_rtl8196c.md
@@ -16,7 +16,7 @@ Fits of all need to get sources from git server.
There is some branches in git. But only one of them intended to
be used for non development purposes its "realtek-unstable"
-```
+```sh
git clone http://git.advem.lv/rtl819xx
cd ./rtl819xx/
git branch -a
@@ -28,7 +28,7 @@ git checkout realtek-unstable
There is supported only compilation with binutils 2.21.1 and
gcc-4.6.x-linaro. Now you should setup that options with menuconfig.
-```
+```sh
make menuconfig
```
@@ -45,7 +45,7 @@ __Binutils Version__ as (binutils 2.21.1)
__GCC compiler Version__ as (gcc 4.6.x with Linaro enhancements)
Last option to switch of is in main menu __Network__
-```
+```text
firewall3
odhcp6c
```
@@ -56,17 +56,17 @@ odhcp6c
It could take some time to compile image.
With some compiling output
-```
+```sh
make V=s
```
Without extra output
-```
+```sh
make
```
Compile in many threads
-```
+```sh
make -j8
```
diff --git a/md/writeup/c_bin2hex.md b/md/writeup/c_bin2hex.md
index 441a115..2d6f4b5 100644
--- a/md/writeup/c_bin2hex.md
+++ b/md/writeup/c_bin2hex.md
@@ -5,7 +5,7 @@ keywords:c,binary,hex
Converts binary file to hex file.
Use:
-```
+```sh
./bin2hex [bin_file] - for local output
./bin2hex [bin_file] [hex_text_file] - for file output
diff --git a/md/writeup/c_macro_tricks.md b/md/writeup/c_macro_tricks.md
index 4068272..e9f9d0f 100644
--- a/md/writeup/c_macro_tricks.md
+++ b/md/writeup/c_macro_tricks.md
@@ -15,10 +15,10 @@ this allows to see resulting source that going to be compiled, macro errors
could be hard to debug, but this is first thing, test them before and then
be sure that everything works. Lets continue with some more deep stuff.
-<!-- ####################################################################### -->
+
## __VA_ARGS__ keyword
-<!-- ####################################################################### -->
+
### Single argument macros
Writting macros with single argument
@@ -42,14 +42,14 @@ F(})
any kind of argument can be passed to macro, and that allows to make some tricks
#### Result
-```
+```c
int main
(){
printf("hello world\n");
}
```
-<!-- ####################################################################### -->
+
### Multi argument macro
writting macro with multiple unamed arguments
@@ -74,7 +74,7 @@ Previouse example works just fine, but if add multiple arguments the __VA_ARGS__
just prints them as a whole string
#### Result
-```
+```c
int main
(){
printf("hello world\n");
@@ -84,7 +84,7 @@ printf("hello world\n");
```
-<!-- ####################################################################### -->
+
### Mixing named arguments and unamed arguments
Mixing together named and unnamed arguments
@@ -108,7 +108,7 @@ F2(int main,{my code},{more code})
#### Result
-```
+```c
2,3,4,5
1
@@ -116,7 +116,7 @@ F2(int main,{my code},{more code})
int main
```
-<!-- ####################################################################### -->
+
## Define struct with macros
Lets move to some more practical example lets just define macro that going to
@@ -172,7 +172,6 @@ struct add {int a; int b;};;
struct dirst {int c; ;};;
```
-<!-- ####################################################################### -->
## Detect number of arguments
There is one trick that can be used to detect number of arguments passed to
@@ -222,12 +221,12 @@ F(1,2,3,4,5)
5
```
-<!-- ####################################################################### -->
+
## Variable argument macro match macro according number of arguments
Detect number of arguments and match macro according to number of arguments
-```
+```c
#define FUN3(X1,X2,X3,...) "there is 3"
#define FUN2(X1,X2,...) "there is 2"
#define FUN1(X1,...) "there is 1"
@@ -237,14 +236,14 @@ Detect number of arguments and match macro according to number of arguments
```
#### Source
-```
+```c
FUN(add,int a,int b);
FUN(mul,int a,int b,int c);
FUN(div,int a);
```
#### Result
-```
+```c
void add ( "there is 2");
void mul ( "there is 3");
void div ( "there is 1");
@@ -257,7 +256,7 @@ void div ( "there is 1");
Best part of it that it can match also typdefed structures. So now macroses
can contain typechecking
-```
+```c
#define type_str(T) _Generic( (T), int: "int",\
long: "long",\
A: "A",\
@@ -287,7 +286,7 @@ int main()
#### Result
-```
+```block
long
int
A
@@ -305,7 +304,7 @@ default: "UNK UNK" )
```
#### Source
-```
+```c
typedef struct A
{
@@ -336,7 +335,7 @@ int int
A A
```
### Generic printf
-```
+```c
#define FF "%f "
#define FS "%s "
#define FD "%d "
@@ -355,7 +354,7 @@ A A
```
#### Source
-```
+```c
int main()
{
A a;
@@ -372,7 +371,7 @@ int main()
#### Result
-```
+```bash
1 2.000000
3 4
big float 0.010000
diff --git a/md/writeup/calculate_fir_coefficients_with_c.md b/md/writeup/calculate_fir_coefficients_with_c.md
index 5e643a6..8d31cb0 100644
--- a/md/writeup/calculate_fir_coefficients_with_c.md
+++ b/md/writeup/calculate_fir_coefficients_with_c.md
@@ -292,14 +292,14 @@ title("my coef freqz");
Snippet code is located at [http://git.main.lv/cgit.cgi/code-snippets.git/tree/fir1](http://git.main.lv/cgit.cgi/code-snippets.git/tree/fir1)
to compile get and compile code run
-```
+```bash
git clone http://git.main.lv/cgit.cgi/code-snippets.git
cd code-snippets/fir1
make
```
run program
-```
+```bash
./simple_fir
```
diff --git a/md/writeup/compile_linux_kernel.md b/md/writeup/compile_linux_kernel.md
index a373caf..2724736 100644
--- a/md/writeup/compile_linux_kernel.md
+++ b/md/writeup/compile_linux_kernel.md
@@ -8,7 +8,7 @@ To get main repo kernel
Default kernel is located here
-```
+```sh
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
```
@@ -34,7 +34,7 @@ Easyes way startup config is just to get whatever you running now. If you hw wor
with current distro then use current kernel config its is stored in procfs _/proc/config.gz_.
Lets go to our kernel repo and do
-```
+```sh
zcat /proc/config.gz > .config
```
now you are ready to compile kernel that will work at begining
@@ -51,19 +51,19 @@ And you will able to run your stuff only with staticly compiled kernel without l
List all loaded modules
-```
+```sh
lsmod
```
See all conntected USB devices
-```
+```sh
lsusb
```
See all PCI devices and modules that they are using
-```
+```sh
lspci -k
```
@@ -72,14 +72,14 @@ This bare minimum of command that you whant to run to start modifing your kernel
## Compiling
Run to configure kernel
-```
+```sh
make menuconfig
```
config is saved in _.config_ file. And now we are ready to
compile our first kernel
-```
+```sh
make
```
@@ -91,19 +91,19 @@ It depends from distro to distro expected way how to install new/fresh/clean ker
Install modules. They all will go /lib/modules/`your kernel version`
-```
+```sh
make modules_install
```
Compy compiled kernel to boot directory
-```
+```sh
cp -v arch/x86_64/boot/bzImage /boot/vmlinuz-linux318
```
Create initram image
-```
+```sh
mkinitcpio -k <kernelversion> -g /boot/initramfs-<file name>.img
```
@@ -125,7 +125,7 @@ https://grsecurity.net/
Latest patches could be downloaded from https://grsecurity.net/download.php#test
Apply patch
-```
+```sh
cd linux-4.7.10
patch -p1 < ../grsecurity-3.1-4.7.10-201610222037.patch
```
diff --git a/md/writeup/compile_python.md b/md/writeup/compile_python.md
index 2acbb1e..13b6446 100644
--- a/md/writeup/compile_python.md
+++ b/md/writeup/compile_python.md
@@ -20,7 +20,7 @@ admin permissions then its probably one way to go.
### Download
-```
+```bash
wget -c https://www.python.org/ftp/python/$(VERSION)/Python-$(VERSION).tgz
tar -xvf Python-$(VERSION).tgz
```
@@ -29,7 +29,7 @@ tar -xvf Python-$(VERSION).tgz
Set flags to make python compiled as static
-```
+```bash
./configure LDFLAGS="-static -static-libgcc" CPPFLAGS="-fPIC -static" --disable-shared --prefix=/custom/install/path
```
@@ -46,7 +46,7 @@ Here example file used
### Compile
-```
+```bash
make
```
@@ -57,14 +57,14 @@ configured installed path.
-```
+```bash
make install
```
Later on set env variables to point to correct location of custom installed python
so can import all modules from correct location
-```
+```bash
PYTHONPATH=/custom/output/lib
PYTHONHOME=/custom/output
```
@@ -76,7 +76,7 @@ PYTHONHOME=/custom/output
### Configure
Set flags to make python compiled as static
-```
+```bash
./configure LDFLAGS="-static -static-libgcc" CPPFLAGS="-fPIC -static" --disable-shared --prefix=/custom/install/path
```
@@ -106,7 +106,7 @@ Did work by default without any changes
Disabled this modules to make it compile
-```
+```bash
_socket
_posix
pwd
@@ -116,13 +116,14 @@ dl
Got alot of linking warnings but did worked and installed at the end.
Selftest failed on:
-```
+```bash
0:01:10 load avg: 0.85 [119/404/14] test_email
make: *** [Makefile:884: test] Segmentation fault
```
### Centos6
Needed to disable modules in Modules/Setup to make it compile
+
```
_socket
_posix
@@ -131,7 +132,7 @@ dl
```
Gcc suggested to use this options
-```
+```bash
-pie -fPIC
```
@@ -147,7 +148,7 @@ Here is located compilation snippet that used to test static compilation
Clone it, goto python directory
#### Python2
-```
+```bash
make download
cp py2/Setup Python-2.X.X/Modules/Setup
make configure
@@ -158,7 +159,7 @@ make install
Output is in **output** directory
#### Python3
-```
+```bash
make download3
cp py3/Setup Python-3.X.X/Modules/Setup
make configure3
diff --git a/md/writeup/cve_2010_1160_exploiting_nano.md b/md/writeup/cve_2010_1160_exploiting_nano.md
index fa27c0b..9124aab 100644
--- a/md/writeup/cve_2010_1160_exploiting_nano.md
+++ b/md/writeup/cve_2010_1160_exploiting_nano.md
@@ -15,7 +15,7 @@ this bug works on < 2.1.7 versions now on my system is latest nano
version and I have compiled many < 2.1.7 versions to test this bug.
To get your nano version run:
-```
+```sh
$ nano -V
```
@@ -31,13 +31,13 @@ How to use it in real life:
4) See result in symlinked file
Everything looks like
-```
+```sh
$nano text.txt
``
Now some one do:
-```
+```sh
$ls -s empty.txt text.txt
```
@@ -70,7 +70,7 @@ Script is only for user and dont work if you try to symlink root
opened nano. It makes all steps as described above. Change script
variables for your tests:
-```
+```text
debug = True
nano = "nano-2.0.9"
user = "user"
diff --git a/md/writeup/datamatch.md b/md/writeup/datamatch.md
index 3d0d9e9..874db87 100644
--- a/md/writeup/datamatch.md
+++ b/md/writeup/datamatch.md
@@ -11,7 +11,7 @@ about that
### Print about position in file
Here how looks scripts to bookmark some position
-```
+```text
0x01 "byte one"
0x02 "byte two"
```
@@ -22,7 +22,7 @@ This could be used to bookmark stuff in files
Here is example where output will tell if its 32/64bit file and with kind of
file type it is relocatable/executable/shared/core elf.
-```
+```text
0x0-0x3
"magic number"
0x4
@@ -43,7 +43,7 @@ file type it is relocatable/executable/shared/core elf.
just make should work
-```
+```sh
make
```
@@ -52,13 +52,13 @@ should work fine as ragel generated *.c file is allready included
## Source
-```
+```sh
git clone http://git.main.lv/cgit.cgi/dm.git
```
or
-```
+```sh
git clone https://github.com/FreeArtMan/dm.git
```
diff --git a/md/writeup/devices/samsung_xe303c12.md b/md/writeup/devices/samsung_xe303c12.md
index 12d260e..c61147c 100644
--- a/md/writeup/devices/samsung_xe303c12.md
+++ b/md/writeup/devices/samsung_xe303c12.md
@@ -41,7 +41,7 @@ you boot, or wait 30 seconds to continue booting.
2. Type shell to get into a bash shell.
3. Type sudo su to become root.
4. Then type this to enable USB booting:
-```
+```text
crossystem dev_boot_usb=1 dev_boot_signed_only=0
```
5. Reboot the system to allow the change to take effect.
@@ -52,11 +52,11 @@ These instructions are written for installing to a USB drive with the sda device
1. Get a root shell as described in the previous section.
2. Since ChromeOS will automatically mount any partitions it finds, unmount everything now:
-```
+```sh
umount /dev/sda*
```
3. Start fdisk to create a GPT partition table:
-```
+```sh
fdisk /dev/sda
```
4. At the fdisk prompt:
@@ -64,12 +64,12 @@ fdisk /dev/sda
4.2. Write the partition table and exit by typing w.
5. Partition the micro SD card:
-```
+```sh
cgpt create /dev/sda
cgpt add -i 1 -t kernel -b 8192 -s 32768 -l Kernel -S 1 -T 5 -P 10 /dev/sda
```
6. To create the rootfs partition, we first need to calculate how big to make the partition using information from cgpt show. Look for the number under the start column for Sec GPT table which is 15633375 in this example:
-```
+```text
localhost / # cgpt show /dev/sda
start size part contents
0 1 PMBR
@@ -83,19 +83,19 @@ cgpt add -i 1 -t kernel -b 8192 -s 32768 -l Kernel -S 1 -T 5 -P 10 /dev/sda
15633407 1 Sec GPT header
```
7. Replace the xxxxx string in the following command with that number to create the root partition:
-```
+```sh
cgpt add -i 2 -t data -b 40960 -s `expr xxxxx - 40960` -l Root /dev/sda
```
8. Tell the system to refresh what it knows about the disk partitions:
-```
+```sh
sfdisk -R /dev/sda
```
9. Format the root partition:
-```
+```sh
mkfs.ext4 /dev/sda2
```
10. Download and extract rootfs tarball:
-```
+```sh
cd /tmp
wget http://archlinuxarm.org/os/ArchLinuxARM-peach-latest.tar.gz
mkdir root
@@ -103,18 +103,18 @@ mount /dev/sda2 root
tar -xf ArchLinuxARM-peach-latest.tar.gz -C root
```
11. Flash the kernel to the kernel partition:
-```
+```sh
dd if=root/boot/vmlinux.kpart of=/dev/sda1
```
12. Unmount the root partition:
-```
+```sh
umount root
sync
```
13. Reboot the computer.
14. At the splash screen, instead of pressing Ctrl-D to go to CromeOS, press Ctrl-U to boot to the external drive.
15. After logging in as root (password is "root"), you can connect to a wireless network by running:
-```
+```sh
wifi-menu
```
diff --git a/md/writeup/dsp_lp_filter.md b/md/writeup/dsp_lp_filter.md
index 856c44b..e54b73a 100644
--- a/md/writeup/dsp_lp_filter.md
+++ b/md/writeup/dsp_lp_filter.md
@@ -17,13 +17,13 @@ If you just use filter as a function then main params is how good are your filte
### Draw first filter