2/27/2015

linux vinagre(rdesktop) 원격 접속 창 크기 변경(windows size)


리눅스의 원격 접속 프로그램인 vinagre 에서 기본 화면 크기를 변경하는 방법입니다.
약간의 트릭을 사용해서 vinagre(원격접속) 에서 기본으로 접근되는 화면 크기 변경이 가능합니다.

# mv /usr/bin/rdesktop /usr/bin/rdesktop.bin


vim /usr/bin/rdesktop

#!/bin/bash
 /usr/bin/rdesktop.bin -g 1024x768 $*

# chmod 755 /usr/bin/rdesktop


Share: | Coffee Me:

2/25/2015

adb shell on linux (리눅스에서 adb 설정)


리눅스에서 adb(Android Debug Bridge) 사용을 위한 설치 및 설정 방법입니다.

일단 android sdk 설치가 필요합니다. 구글링 통해서 다운로드 하셔도 되고 이클립스 설치 시 같이 설치하는 방법도 있습니다.

Linux에서 Eclipse 설치
(www.codeblack.net/2015/02/install-eclipseandroid-on-linux-eclipse.html)


#apt-get install eclipse

eclipse > help > install new software > add
https://dl-ssl.google.com/android/eclipse/
 android sdk 설치


Android SDK 설치 경로 하위에 platform-tools 디렉토리가 존재합니다.

~~~/Android/platform-tools

해당 디렉토리 아래 adb 바이너리 파일이 있습니다. 실행해보면 adb shell 인 것을 확인할 수 있습니다.



# ./adb

사용하기 쉽게 bashrc에 등록하여 명령처럼 쓸 수 있도록 설정합니다.

# vim .bashrc

.bashrc
alias adb='~~~/Android/platform-tools/adb'

~~~  == Your Android SDK Directory

# adb version
Android Debug Bridge version 1.0.32



----------------------------------------------------------------------------------------------------------

adb options
Android Debug Bridge version 1.0.32

 -a                            - directs adb to listen on all interfaces for a connection
 -d                            - directs command to the only connected USB device
                                 returns an error if more than one USB device is present.
 -e                            - directs command to the only running emulator.
                                 returns an error if more than one emulator is running.
 -s <specific device>          - directs command to the device or emulator with the given
                                 serial number or qualifier. Overrides ANDROID_SERIAL
                                 environment variable.
 -p <product name or path>     - simple product name like 'sooner', or
                                 a relative/absolute path to a product
                                 out directory like 'out/target/product/sooner'.
                                 If -p is not specified, the ANDROID_PRODUCT_OUT
                                 environment variable is used, which must
                                 be an absolute path.
 -H                            - Name of adb server host (default: localhost)
 -P                            - Port of adb server (default: 5037)
 devices [-l]                  - list all connected devices
                                 ('-l' will also list device qualifiers)
 connect <host>[:<port>]       - connect to a device via TCP/IP
                                 Port 5555 is used by default if no port number is specified.
 disconnect [<host>[:<port>]]  - disconnect from a TCP/IP device.
                                 Port 5555 is used by default if no port number is specified.
                                 Using this command with no additional arguments
                                 will disconnect from all connected TCP/IP devices.

device commands:
  adb push [-p] <local> <remote>
                               - copy file/dir to device
                                 ('-p' to display the transfer progress)
  adb pull [-p] [-a] <remote> [<local>]
                               - copy file/dir from device
                                 ('-p' to display the transfer progress)
                                 ('-a' means copy timestamp and mode)
  adb sync [ <directory> ]     - copy host->device only if changed
                                 (-l means list but don't copy)
                                 (see 'adb help all')
  adb shell                    - run remote shell interactively
  adb shell <command>          - run remote shell command
  adb emu <command>            - run emulator console command
  adb logcat [ <filter-spec> ] - View device log
  adb forward --list           - list all forward socket connections.
                                 the format is a list of lines with the following format:
                                    <serial> " " <local> " " <remote> "\n"
  adb forward <local> <remote> - forward socket connections
                                 forward specs are one of:
                                   tcp:<port>
                                   localabstract:<unix domain socket name>
                                   localreserved:<unix domain socket name>
                                   localfilesystem:<unix domain socket name>
                                   dev:<character device name>
                                   jdwp:<process pid> (remote only)
  adb forward --no-rebind <local> <remote>
                               - same as 'adb forward <local> <remote>' but fails
                                 if <local> is already forwarded
  adb forward --remove <local> - remove a specific forward socket connection
  adb forward --remove-all     - remove all forward socket connections
  adb reverse --list           - list all reverse socket connections from device
  adb reverse <remote> <local> - reverse socket connections
                                 reverse specs are one of:
                                   tcp:<port>
                                   localabstract:<unix domain socket name>
                                   localreserved:<unix domain socket name>
                                   localfilesystem:<unix domain socket name>
  adb reverse --norebind <remote> <local>
                               - same as 'adb reverse <remote> <local>' but fails
                                 if <remote> is already reversed.
  adb reverse --remove <remote>
                               - remove a specific reversed socket connection
  adb reverse --remove-all     - remove all reversed socket connections from device
  adb jdwp                     - list PIDs of processes hosting a JDWP transport
  adb install [-lrtsd] <file>
  adb install-multiple [-lrtsdp] <file...>
                               - push this package file to the device and install it
                                 (-l: forward lock application)
                                 (-r: replace existing application)
                                 (-t: allow test packages)
                                 (-s: install application on sdcard)
                                 (-d: allow version code downgrade)
                                 (-p: partial application install)
  adb uninstall [-k] <package> - remove this app package from the device
                                 ('-k' means keep the data and cache directories)
  adb bugreport                - return all information from the device
                                 that should be included in a bug report.

  adb backup [-f <file>] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all] [-system|-nosystem] [<packages...>]
                               - write an archive of the device's data to <file>.
                                 If no -f option is supplied then the data is written
                                 to "backup.ab" in the current directory.
                                 (-apk|-noapk enable/disable backup of the .apks themselves
                                    in the archive; the default is noapk.)
                                 (-obb|-noobb enable/disable backup of any installed apk expansion
                                    (aka .obb) files associated with each application; the default
                                    is noobb.)
                                 (-shared|-noshared enable/disable backup of the device's
                                    shared storage / SD card contents; the default is noshared.)
                                 (-all means to back up all installed applications)
                                 (-system|-nosystem toggles whether -all automatically includes
                                    system applications; the default is to include system apps)
                                 (<packages...> is the list of applications to be backed up.  If
                                    the -all or -shared flags are passed, then the package
                                    list is optional.  Applications explicitly given on the
                                    command line will be included even if -nosystem would
                                    ordinarily cause them to be omitted.)

  adb restore <file>           - restore device contents from the <file> backup archive

  adb help                     - show this help message
  adb version                  - show version num

scripting:
  adb wait-for-device          - block until device is online
  adb start-server             - ensure that there is a server running
  adb kill-server              - kill the server if it is running
  adb get-state                - prints: offline | bootloader | device
  adb get-serialno             - prints: <serial-number>
  adb get-devpath              - prints: <device-path>
  adb status-window            - continuously print device status for a specified device
  adb remount                  - remounts the /system and /vendor (if present) partitions on the device read-write
  adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery program
  adb reboot-bootloader        - reboots the device into the bootloader
  adb root                     - restarts the adbd daemon with root permissions
  adb usb                      - restarts the adbd daemon listening on USB
  adb tcpip <port>             - restarts the adbd daemon listening on TCP on the specified port
networking:
  adb ppp <tty> [parameters]   - Run PPP over USB.
 Note: you should not automatically start a PPP connection.
 <tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
 [parameters] - Eg. defaultroute debug dump local notty usepeerdns

adb sync notes: adb sync [ <directory> ]
  <localdir> can be interpreted in several ways:

  - If <directory> is not specified, /system, /vendor (if present), and /data partitions will be updated.

  - If it is "system", "vendor" or "data", only the corresponding partition
    is updated.

environmental variables:
  ADB_TRACE                    - Print debug information. A comma separated list of the following values
                                 1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp
  ANDROID_SERIAL               - The serial number to connect to. -s takes priority over this if given.
  ANDROID_LOG_TAGS             - When used with the logcat option, only these debug tags are printed.
Share: | Coffee Me:

Install Eclipse/Android on linux(데비안 리눅스에서 Eclipse 설치 및 안드로이드 설치)

리눅스에서 eclipse 설치 및 안드로이드 개발 환경 구성 방법입니다.
이전에 운영하던 블로그 내용과 많이 유사하긴 하지만..가끔씩 필요하기 때문에 재 작성하였습니다.

1. Install Eclipse
이클립스 공식 홈페이지(https://www.eclipse.org/) 에서 eclipse 다운로드합니다.
(직접 다운로드 시 Java 설치도 필요합니다. )



JDK8
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

JRE8
http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

or

데비안 계열 리눅스(데비안,우분투,민트 등)에서는 apt 를 통해 쉽게 설치가 가능합니다.

#apt-get install eclipse 


2. Install Android SDK

이클립스 실행 후 help > Install New Software 로 들어갑니다. 





Add 버튼을 눌러 아래 주소를 추가합니다.

https://dl-ssl.google.com/android/eclipse/




Develope Tools에서 필요한 부분에 대해 체크 후 Next를 눌러 Review License로 넘어갑니다.
라이센스 동의 후 Finish를 통해 설치가 가능합니다.

설치가 완료되면 이클립스가 재 시작되고 Windows > Android SDK에서 체크 후 설치하면 됩니다. (최근에 설치 했을 땐 재 시작 후 자동으로 확인되었던 것 같네요.)




 설치 완료 후 프로젝트 생성을 통해 android 프로젝트를 생성하여 확인하시면 됩니다.
(File > New > Project >Android Project)

감사합니다.


Share: | Coffee Me:

2/20/2015

Debian Wheezy 에서 Ruby Version Upgrade(1.9 > 2.1) #Metasploit 업그레이드, rvm,rbenv


오랜만에 노트북에서 Metasploit 업데이트를 하였더니 패키지 하나가 의존성 문제가 걸리더군요..

gem 으로 설치하려 했으나, 발생하는 건 ruby2.1 이상에서 설치 가능하다는 메시지였습니다.

rvm이나 rbenv를 통해 간단하게 업그레이드가 가능합니다.
(Upgrade Ruby version :: 1.9 -> 2.1)

rvm install 2.1.5 &&
rvm --create --versions-conf use 2.1.5@metasploit-framework &&
pushd ..; popd &&
bundle install

source /etc/profile


혹시나 rvm 설치가 안된다면 아래와 방법으로 설치 가능합니다.
(Install RVM)
# 키 세팅
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

#curl로 rvm 다운로드 및 실행
\curl -sSL https://get.rvm.io | bash


#/etc/profile 적용 후 사용
source /etc/profile




#--------------------------------------------------#
.bashrc

...
source /etc/profile








Share: | Coffee Me:

2/05/2015

2/01/2015

Debian(ubuntu) linux 마우스 절전모드 해제(off auto suspend)

마우스 절전모드 해제 방법입니다.
리눅스 설치 시 laptop 모드 포함하여 설치 시 기본적으로 마우스의 절전모드가 걸리게 됩니다.
절전모드가 걸려있다면 3~4초 마다 마우스가 꺼져 추가 동작으로 마우스 전원을 올려줘야 합니다.

일반적인 마우스 사용처럼 설정하려면 laptop-mode의 usb-autosuspend.conf 수정이필요합니다.

# vim /etc/laptop-mode/conf.d/usb-autosuspend.conf


usb-autosuspend.conf 파일에서 아래 부부을 auto에서 0 으로 수정합니다.

/etc/laptop-mode/conf.d/usb-autosuspend.conf.

CONTROL_USB_AUTOSUSPEND=0   #auto -> 0

/etc/laptop-mode/conf.d/usb-autosuspend.conf
Share: | Coffee Me: