This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
user:mp010784:start [2016/04/28 19:16] – mp010784 | user:mp010784:start [2016/05/01 18:10] – mp010784 | ||
---|---|---|---|
Line 25: | Line 25: | ||
Then simply rebooting and following the guided installation as most Linux distributions typically have, you can finish up the basic vanilla installation and set a root password and install the bootloader to /dev/sda on the new samba server machine.\\ | Then simply rebooting and following the guided installation as most Linux distributions typically have, you can finish up the basic vanilla installation and set a root password and install the bootloader to /dev/sda on the new samba server machine.\\ | ||
- | 3) Install | + | 3) Now that the new machine should have a bootable functioning bare bones Debian Linux system on it, we need to install the samba server software and maybe the samba client software. |
- | 2) For the second step one needs to format | + | |
- | 4) Configure samba\\ | + | < |
+ | sudo apt-get install samba smbclient | ||
+ | </ | ||
+ | |||
+ | That is pretty much it for basic installation of Samba File Server services onto this system all that remains is to configure the samba server to your desires and needs for the file server.\\ | ||
+ | |||
+ | 4) Configure samba. | ||
+ | < | ||
+ | |||
+ | [global] | ||
+ | workgroup = SIMPLE | ||
+ | [test] | ||
+ | comment = For testing only, please | ||
+ | path = / | ||
+ | read only = no | ||
+ | guest ok = yes | ||
+ | |||
+ | </ | ||
+ | |||
+ | Some additional documentation about the Samba configuration: | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | And for no apparent reason, this one man band guy playing "No Woman, No Cry": | ||
+ | |||
+ | {{youtube> | ||
+ | |||
+ | ==== Playing around with GDB==== | ||
+ | |||
+ | After taking Data Structures I wanted | ||
+ | |||
+ | One fo the first things this book had me do was create a Hello World program with a loop in C as seen below:\\ | ||
+ | |||
+ | < | ||
+ | #include < | ||
+ | |||
+ | int main() | ||
+ | { | ||
+ | int i; | ||
+ | for(i=0; | ||
+ | { | ||
+ | printf(" | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Then we compile the code with debugging symbols: | ||
+ | |||
+ | < | ||
+ | gcc -g firstprog.c | ||
+ | </ | ||
+ | |||
+ | which creates the executable a.out file which when run generates on the command line the output:\\ | ||
+ | |||
+ | < | ||
+ | ╭─robgraves@arrakis ~ | ||
+ | ╰─➤ | ||
+ | ╭─robgraves@arrakis ~ | ||
+ | ╰─➤ | ||
+ | ╭─robgraves@arrakis ~ | ||
+ | ╰─➤ | ||
+ | Hello, World! | ||
+ | Hello, World! | ||
+ | Hello, World! | ||
+ | Hello, World! | ||
+ | Hello, World! | ||
+ | Hello, World! | ||
+ | Hello, World! | ||
+ | Hello, World! | ||
+ | Hello, World! | ||
+ | Hello, World! | ||
+ | ╭─robgraves@arrakis ~ | ||
+ | ╰─➤ | ||
+ | </ | ||
+ | |||
+ | Then you can load up the program in gdb using the -q option to suppress all the startup messages from gdb:\\ | ||
+ | |||
+ | < | ||
+ | gdb -q ./a.out | ||
+ | </ | ||
+ | |||
+ | which should bring us to a gdb prompt that looks like:\\ | ||
+ | |||
+ | < | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | Then we run:\\ | ||
+ | < | ||
+ | (gdb)list | ||
+ | </ | ||
+ | |||
+ | which shows us the code in our program and then run disassemble main:\\ | ||
+ | |||
+ | < | ||
+ | disassemble main | ||
+ | </ | ||
+ | |||
+ | which shows us the assembly for our code for this build. | ||
+ | |||
+ | < | ||
+ | # | ||
+ | |||
+ | set disassembly intel | ||
+ | #set disassembly att | ||
+ | </ | ||
+ | |||
+ | which this is actually all that I have in my .gdbinit file.\\ | ||
+ | |||
+ | The resulting output from the list commadn and disassemble main in gdb appears as:\\ | ||
+ | |||
+ | < | ||
+ | (gdb) list | ||
+ | 1 #include < | ||
+ | 2 | ||
+ | 3 int main() | ||
+ | 4 { | ||
+ | 5 int i; | ||
+ | 6 for(i=0; i < 10; i++) | ||
+ | 7 { | ||
+ | 8 printf(" | ||
+ | 9 } | ||
+ | 10 } | ||
+ | (gdb) disassemble main | ||
+ | Dump of assembler code for function main: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | End of assembler dump. | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | Now we set a breakpoint at main by running: | ||
+ | |||
+ | < | ||
+ | break main | ||
+ | </ | ||
+ | |||
+ | then we run the program with:\\ | ||
+ | |||
+ | < | ||
+ | run | ||
+ | </ | ||
+ | |||
+ | At this point the book tells me to run (gdb)info register eip , which ends up spitting an error stating invalid register " | ||
+ | |||
+ | So then I run from my machine with the discrepency solved:\\ | ||
+ | < | ||
+ | (gdb)info register rip | ||
+ | </ | ||
+ | |||
+ | Which works and gives me the info in the current instruction pointer register which looks like this:\\ | ||
+ | |||
+ | < | ||
+ | (gdb) run | ||
+ | Starting program: / | ||
+ | |||
+ | Breakpoint 1, main () at firstprog.c: | ||
+ | 6 for(i=0; i < 10; i++) | ||
+ | (gdb) info register eip | ||
+ | Invalid register `eip' | ||
+ | (gdb) info register rip | ||
+ | rip 0x400535 0x400535 < | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | A shortcut for this command is "i r rip" for "info register rip" in addition we can examine the given address. | ||
+ | |||
+ | < | ||
+ | (gdb) info register rip | ||
+ | rip 0x400535 0x400535 < | ||
+ | (gdb) i r rip | ||
+ | rip 0x400535 0x400535 < | ||
+ | (gdb) x/o 0x400535 | ||
+ | 0x400535 < | ||
+ | (gdb) x/o $rip | ||
+ | 0x400535 < | ||
+ | (gdb) x/x $rip | ||
+ | 0x400535 < | ||
+ | (gdb) x/u $rip | ||
+ | 0x400535 < | ||
+ | (gdb) x/t $rip | ||
+ | 0x400535 < | ||
+ | (gdb) x/2x | ||
+ | 0x400539 < | ||
+ | (gdb) x/2x $rip | ||
+ | 0x400535 < | ||
+ | (gdb) x/12x $rip | ||
+ | 0x400535 < | ||
+ | 0x400545 < | ||
+ | 0x400555: | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | We can also examine the info by b for a single byte, h for a halfword which is two bytes, or w for a word, or g for a giant which is 8 bytes:\\ | ||
+ | |||
+ | < | ||
+ | (gdb) x/8xb $rip | ||
+ | 0x400535 < | ||
+ | (gdb) x/8xh $rip | ||
+ | 0x400535 < | ||
+ | (gdb) x/8xw $rip | ||
+ | 0x400535 < | ||
+ | 0x400545 < | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | You can also go on to examine the instructions at the register with x/i or multiples say with x/3i:\\ | ||
+ | |||
+ | < | ||
+ | (gdb) x/i $rip | ||
+ | => 0x400535 < | ||
+ | (gdb) x/3i $rip | ||
+ | => 0x400535 < | ||
+ | | ||
+ | | ||
+ | (gdb) x/7xb $rip | ||
+ | 0x400535 < | ||
+ | (gdb) x/i $rip | ||
+ | => 0x400535 < | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | The book has me play around with some of the info at the registers a little more, most notibly is the nexti command which seems to move to the next instruction: | ||
+ | |||
+ | < | ||
+ | (gdb) x i rbp | ||
+ | A syntax error in expression, near `rbp' | ||
+ | (gdb) i r rbp | ||
+ | rbp 0x7fffffffe5e0 0x7fffffffe5e0 | ||
+ | (gdb) x/4xb $rbp - 4 | ||
+ | 0x7fffffffe5dc: | ||
+ | (gdb) x/4xb 0x7fffffffe5dc | ||
+ | 0x7fffffffe5dc: | ||
+ | (gdb) print $rbp -4 | ||
+ | $1 = (void *) 0x7fffffffe5dc | ||
+ | (gdb) x/4xb $1 | ||
+ | 0x7fffffffe5dc: | ||
+ | (gdb) x/xw $1 | ||
+ | 0x7fffffffe5dc: | ||
+ | (gdb) nexti | ||
+ | 0x000000000040053c 6 | ||
+ | (gdb) x/4xb $1 | ||
+ | 0x7fffffffe5dc: | ||
+ | (gdb) x/dw $1 | ||
+ | 0x7fffffffe5dc: | ||
+ | (gdb) i r rip | ||
+ | rip 0x40053c 0x40053c < | ||
+ | (gdb) x/i $rip | ||
+ | => 0x40053c < | ||
+ | (gdb) x/10i $rip | ||
+ | => 0x40053c < | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | Then moving further along in the intructions: | ||
+ | |||
+ | < | ||
+ | (gdb) nexti | ||
+ | 0x000000000040054c 6 | ||
+ | (gdb) x/i $rip | ||
+ | => 0x40054c < | ||
+ | (gdb) nexti | ||
+ | 0x0000000000400550 6 | ||
+ | (gdb) x/i $rip | ||
+ | => 0x400550 < | ||
+ | (gdb) nexti | ||
+ | 8 printf(" | ||
+ | (gdb) i r rip | ||
+ | rip 0x40053e 0x40053e < | ||
+ | (gdb) x/2i $rip | ||
+ | => 0x40053e < | ||
+ | | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | Then we look at the stack pointer at rsp register: | ||
+ | |||
+ | < | ||
+ | (gdb) i r rdi | ||
+ | rdi 0x1 1 | ||
+ | (gdb) i r rsp | ||
+ | rsp 0x7fffffffe5d0 0x7fffffffe5d0 | ||
+ | (gdb) x/2xw 0x4005e4 | ||
+ | 0x4005e4: | ||
+ | (gdb) x/6xb 0x4005e4 | ||
+ | 0x4005e4: | ||
+ | (gdb) x/6ub 0x4005e4 | ||
+ | 0x4005e4: | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | The above 6 units in hex or in decimal are the ASCII values for " | ||
+ | |||
+ | < | ||
+ | (gdb) x/6cb 0x4005e4 | ||
+ | 0x4005e4: | ||
+ | (gdb) x/s 0x4005e4 | ||
+ | 0x4005e4: | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | And we continue on:\\ | ||
+ | |||
+ | < | ||
+ | (gdb) x/2i $rip | ||
+ | => 0x40053e < | ||
+ | | ||
+ | (gdb) x/xw $rip | ||
+ | 0x40053e < | ||
+ | (gdb) nexti | ||
+ | 0x0000000000400543 8 | ||
+ | (gdb) x/xw $esp | ||
+ | 0xffffffffffffe5d0: | ||
+ | (gdb) x/xw $rsp | ||
+ | 0x7fffffffe5d0: | ||
+ | (gdb) x/i rip | ||
+ | No symbol " | ||
+ | (gdb) x/i $rip | ||
+ | => 0x400543 < | ||
+ | (gdb) nexti | ||
+ | Hello, World! | ||
+ | 6 for(i=0; i < 10; i++) | ||
+ | (gdb) x/2i $rip | ||
+ | => 0x400548 < | ||
+ | | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | I'm gonna pretty much end here as this is where I'm starting to trail off, but I found doing this to be interesting and want to keep digging down this rabbit hole.\\ | ||
+ | |||
+ | < | ||
+ | (gdb) nexti | ||
+ | 0x0000000000400543 8 | ||
+ | (gdb) x/xw $esp | ||
+ | 0xffffffffffffe5d0: | ||
+ | (gdb) x/xw $rsp | ||
+ | 0x7fffffffe5d0: | ||
+ | (gdb) x/i rip | ||
+ | No symbol " | ||
+ | (gdb) x/i $rip | ||
+ | => 0x400543 < | ||
+ | (gdb) nexti | ||
+ | Hello, World! | ||
+ | 6 for(i=0; i < 10; i++) | ||
+ | (gdb) x/2i $rip | ||
+ | => 0x400548 < | ||
+ | | ||
+ | (gdb) x/i $rip | ||
+ | => 0x400548 < | ||
+ | (gdb) x/dw $eax | ||
+ | 0xe: Cannot access memory at address 0xe | ||
+ | (gdb) x/dw $rax | ||
+ | 0xe: Cannot access memory at address 0xe | ||
+ | (gdb) x/dw $rbp | ||
+ | 0x7fffffffe5e0: | ||
+ | (gdb) nexti | ||
+ | 0x000000000040054c 6 | ||
+ | (gdb) x/dw $rbp | ||
+ | 0x7fffffffe5e0: | ||
+ | (gdb) x/dw $eax | ||
+ | 0xe: Cannot access memory at address 0xe | ||
+ | (gdb) x/i $rip | ||
+ | => 0x40054c < | ||
+ | (gdb) nexti | ||
+ | 0x0000000000400550 6 | ||
+ | (gdb) x/dw $eax | ||
+ | 0xe: Cannot access memory at address 0xe | ||
+ | (gdb) x/i $rip | ||
+ | => 0x400550 < | ||
+ | (gdb) disass main | ||
+ | Dump of assembler code for function main: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | => 0x0000000000400550 < | ||
+ | | ||
+ | | ||
+ | End of assembler dump. | ||
+ | (gdb) list | ||
+ | 1 #include < | ||
+ | 2 | ||
+ | 3 int main() | ||
+ | 4 { | ||
+ | 5 int i; | ||
+ | 6 for(i=0; i < 10; i++) | ||
+ | 7 { | ||
+ | 8 printf(" | ||
+ | 9 } | ||
+ | 10 } | ||
+ | (gdb) | ||
+ | |||
+ | </ | ||
+ | |||
+ | Maybe over the summer I'll more time to delve into this hacking book abit more and see what else I can experiment with.\\ | ||
+ | |||
+ | Some Old Stuff - Something something dark side.\\ | ||
- | TO DO: Clean up and expand the above list to have some actual useful info\\ | ||
<WRAP info>The real wiki will go above all the video jazz.</ | <WRAP info>The real wiki will go above all the video jazz.</ |