hw-1

Xdebug for XAMPP on OSX

install autoconf

1
$ brew install autoconf

install debug

1
2
3
4
5
6
7
8
9
wget http://xdebug.org/files/xdebug-2.5.3.tgz
tar -xvzf xdebug-2.5.3.tgz
cd xdebug-2.5.3
phpize
./configure --enable-xdebug --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config
make
modules_path=$(find /Applications/XAMPP/xamppfiles/lib/php/extensions -name "no-debug-non-zts*")
echo $modules_path
sudo cp modules/xdebug.so $modules_path
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//Edit /Applications/XAMPP/xamppfiles/etc/php.ini
//After zend_extension
zend_extension=xdebug.so
//add xdebug configure
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_autostart = 1
xdebug.remote_port=9000
xdebug.show_local_vars=1
xdebug.remote_log=/Applications/XAMPP/logs/xdebug.log
//Optional – for development only
//Find max_execution_time and set to unlimited:
max_execution_time=0

Restart Apache using XAMPP’s manager-osx

How to encrypt a big file using OpenSSL and someone’s public key

How to encrypt a big file using OpenSSL and someone’s public key
The situation

You have a public key for someone, you have a file you want to send them, you want to send it securely.

Can you call them, securely chat with them, or send them an encrypted e-mail?

If you are set up to chat over OTR with them or to send them an encrypted e-mail, just use that to send your file. It’ll be faster. If you can call them, then call them and agree on a symmetric key. Then just use that key to encrypt the file like this. If you can’t (or don’t want to) do either of those, then you can follow this how-to.

Step 0) Get their public key

The other person needs to send you their public key in .pem format. If they only have it in rsa format (e.g., they use it for ssh), then have them do:

openssl rsa -in id_rsa -outform pem > id_rsa.pem

openssl rsa -in id_rsa -pubout -outform pem > id_rsa.pub.pem```


Have them send you id_rsa.pub.pem

Step 1) Generate a 256 bit (32 byte) random key

```bash
openssl rand -base64 32 > key.bin```


Step 2) Encrypt the key

```bash
openssl rsautl -encrypt -inkey id_rsa.pub.pem -pubin -in key.bin -out key.bin.enc```


Step 3) Actually Encrypt our large file

```bash
openssl enc -aes-256-cbc -salt -in SECRET_FILE -out SECRET_FILE.enc -pass file:./key.bin```


Step 4) Send/Decrypt the files

Send the .enc files to the other person and have them do:

```bash
openssl rsautl -decrypt -inkey id_rsa.pem -in key.bin.enc -out key.bin

openssl enc -d -aes-256-cbc -in SECRET_FILE.enc -out SECRET_FILE -pass file:./key.bin ```

raspberry pi3 wifi config

###change ssh default keys

1
rm /etc/ssh/ssh_host_*

###dpkg-reconfigure openssh-server

1
service ssh restart

###config wifi

1
2
3
4
5
6
7
vim /etc/network/interfaces
auto wlan0
iface wlan0 inet dhcp
wpa-ssid “your network name”
wpa-psk “the network password”
//restart
service networking restart

###list pci

1
2
apt install pciutils
lspci

ubuntu max ulimit

1
2
3
4
5
6
7
8
ulimit -a
open files (-n) 1024
vim /etc/security/limits.conf
//append
* hard nofile 40960
* soft nofile 40960
vim /etc/profile
ulimit -SHn 40960

reavealapp dynamic load

1
2
3
4
5
6
7
8
1, Add Symbolic Breakpoint
2, Enter UIApplicationMain into the Symbol field.
3, Click the Add Action button, and ensure that Action is set to Debugger Command.
4, Copy and paste the following text into the field below:
expr (Class)NSClassFromString(@"IBARevealLoader") == nil ? (void *)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 0x2) : ((void*)0)

5, Check Automatically continue after evaluating actions.
6, Right click the newly created breakpoint and select Move Breakpoint To → User.

Xcode8 install Alcatraz

1
2
sudo codesign --remove-signature /Applications/Xcode.app/Contents/MacOS/Xcode 
curl -fsSL https://raw.github.com/alcatraz/Alcatraz/master/Scripts/install.sh | sh

mongodb example command

1
2
3
4
5
6
7
8
./mongorestore   --dir  ./dump/radacctinfo  --db radacctinfo
./mongodump --host 127.0.0.1 --db local
./mongo mongodb://127.0.0.1
sudo ./mongod --dbpath /data/db
show dbs
use local
show tables
db.radacctinfo.find().pretty()