Thursday, July 6, 2017

scp example

Copy the file "foobar.txt" from a remote host to the local host

    $ scp your_username@remotehost.edu:~/work/foobar.txt ./some/local/directory

Copy the file "foobar.txt" from the local host to a remote host

    $ scp foobar.txt your_username@remotehost.edu:~/some/remote/directory

Copy the directory "foo" from the local host to a remote host's directory "bar"

    $ scp -r foo your_username@remotehost.edu:~/some/remote/directory/bar

Copy the file "foobar.txt" from remote host "rh1.edu" to remote host "rh2.edu"

    $ scp your_username@rh1.edu:/some/remote/directory/foobar.txt \
    your_username@rh2.edu:/some/remote/directory/

Copying the files "foo.txt" and "bar.txt" from the local host to your home directory on the remote host

    $ scp foo.txt bar.txt your_username@remotehost.edu:~

Copy the file "foobar.txt" from the local host to a remote host using port 2264

    $ scp -P 2264 foobar.txt your_username@remotehost.edu:/some/remote/directory

Copy multiple files from the remote host to your current directory on the local host

    $ scp your_username@remotehost.edu:/some/remote/directory/\{a,b,c\} .
    $ scp your_username@remotehost.edu:~/\{foo.txt,bar.txt\} .

Friday, June 23, 2017

wireshark tips

to find binary contents

frame contains 00:40:3f
(rather than 00403f, if you're searching for a byte with the value hex 00, followed by a byte with the value hex 40, followed by a byte with the value hex 3f) will match regardless of whether the frames are Ethernet frames or not.
to find string
frame contains "string"

Wednesday, June 14, 2017

802.11ac channel segment calculation

Seg0 = center frequency channel
Seg0 = (primary channel number) + (((bandwidth / 2) - 10) / 5)
* ( bandwidth / 2 ) = look up center
* ( -10 ) = 20MHz channel center is 10Mhz above
* ( /5 ) = 1 channel width is 5Mhz

Ch36 40MHz Seg0 = 36 + (((40 / 2) - 10) / 5) = 38 (36 + 2)
Ch36 80MHz Seg0 = 36 + (((80 / 2) - 10) / 5) = 42 (36 + 6)
Ch36 160MHz Seg0 = 36 + (((160 / 2) - 10) / 5) = 50 (36 + 14)

dot11CurrentChannelWidth
Channel width. Possible values represent 20 MHz, 40 MHz,
80 MHz, 160 MHz, and 80+80 MHz channels.

dot11CurrentChannelCenterFrequencyIndex0
For a 20 MHz, 40 MHz, 80 MHz, or 160 MHz channel, denotes
the channel center frequency.
For an 80+80 MHz channel, denotes the center frequency of the
frequency segment 0, which is the frequency segment containing
the primary channel.
Valid range is 1 to 200.
See Equation (22-102).

dot11CurrentChannelCenterFrequencyIndex1
For an 80+80 MHz channel, denotes the center frequency of the
frequency segment 1, which is the frequency segment that does
not contain the primary channel.
Valid range is 1 to 200.
See Equation (22-102).
For a 20 MHz, 40 MHz, 80 MHz, or 160 MHz channel, set to 0.

dot11CurrentPrimaryChannel
Denotes the location of the primary 20 MHz channel.
Valid range is 1 to 200.
See Equation (22-103).

22-103:
Primary 20 MHz channel center frequency [MHz]
= Channel starting frequency + 5 x dot11CurrentPrimaryChannel
ex) channel 36: 5000MHz + 5 x 36 = 5180Mhz
dot11CurrentPrimaryChannel = (5180 - 5000) / 5 = 36

22-102:
VHT80 Channel 36 center frequency = 5000 + 5 x 36 = 5180Mhz
* Ch36 80MHz Seg0 = 36 + (((80 / 2) - 10) / 5) = 42 (36 + 6)
Channel center frequency [MHz]
= Channel starting frequency + 5 x dot11CurrentChannelCenterFrequencyIndex
Channel center frequency [MHz] = 5000 + 5 x 42 = 5210MHz
dot11CurrentChannelCenterFrequencyIndex = dot11CurrentChannelCenterFrequencyIndex0 = 42

dot11CurrentChannelCenterFrequencyIndex is either dot11CurrentChannelCenterFrequencyIndex0 or
dot11CurrentChannelCenterFrequencyIndex1

Tuesday, April 18, 2017

android memory analysis

adb shell dumpsys meminfo <package name | PID > [-d]

* Android Studio
View > Tool Windows > Android Monitor
> Select Monitors tab

* Capture a heap dump
At Memory monitor -> click Dump Java Heap
to convert : in Capture tab -> right click -> Export to standard .hprof

https://developer.android.com/studio/profile/investigate-ram.html#ViewHeap