텔레그램 Cli 버전이 있어 설치하여 연동이 가능하다니 신기하네요. 기본적인 설치 방법을 정리하였습니다.



※ 설치절차


- Update the packages with


sudo apt-get update

sudo apt-get upgrade



- Install libs

  readline or libedit, openssl and (if you want to use config) libconfig and liblua. If you do

  not want to use them pass options --disable-libconfig and --disable-liblua respectively.


sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev make


저는 여기서 libjansson 없다고 에러가 발생했습니다. 그래서 apt-get install libjansson 했더니 안되더군요. HARDCOPYWORLD 사이트에서 참조해서 해결했습니다.


sudo apt-get install libjansson-dev


python dev 에러일 경우

sudo apt-get install python-dev



- Clone GitHub Repository

git clone --recursive https://github.com/vysheng/tg.git && cd tg 

./configure

make

Running this command takes a little time and after install is done.



- Utilization

Navigate to the folder tg

cd tg

then

bin/telegram-cli -k tg-server.pub -W


  instructables.com의 안내에 따라서 했는데 에러가 발생했습니다.

pi@raspberrypi:~/tg $ bin/telegram-cli -k tg-server.pub -W

Telegram-cli version 1.4.1, Copyright (C) 2013-2015 Vitaly Valtman

Telegram-cli comes with ABSOLUTELY NO WARRANTY; for details type `show_license'.

This is free software, and you are welcome to redistribute it

under certain conditions; type `show_license' for details.

Telegram-cli uses libtgl version 2.1.0

Telegram-cli includes software developed by the OpenSSL Project

for use in the OpenSSL Toolkit. (http://www.openssl.org/)

I: config dir=[/home/pi/.telegram-cli]

telegram-cli: tgl/mtproto-utils.c:101: BN2ull: Assertion 0' failed. SIGNAL received


  해당에러는 tgl/mtproto-utils.c의 101번재 줄에서 발생해서 인터넷을 검색하니 해당 줄을

  주석처리하고 다시 재컴파일 하면 문제가 없다고 합니다. 다행이 저는 잘 동작하네요.

101번 줄에 주석 //를 추가합니다.


sudo vi tgl/mtproto-utils.c


     97 static unsigned long long BN2ull (TGLC_bn *b) {

     98   if (sizeof (unsigned long) == 8) {

     99     return TGLC_bn_get_word (b);

    100   } else if (sizeof (unsigned long long) == 8) {

    101     //assert (0); // As long as nobody ever uses this code, assume it is broken.

    102     unsigned long long tmp;

    103     /* Here be dragons, but it should be okay due to be64toh */

    104     TGLC_bn_bn2bin (b, (unsigned char *) &tmp);

    105     return be64toh (tmp);

    106   } else {

    107     assert (0);

    108   }


sudo make clean

sudo make


  초기 인증 설정


sudo bin/telegram-cli -k tg-server.pub -W

phone number: +82xxxxxxxxxx

code ('call' for phone call): xxxxx


  메세지 보내기

  메세지는 msg 명령으로 보내며 이름, 성 순서이며 공백은 _ 로 대체합니다.


  msg 현수_유 안녕하세요.



  한글이 깨지는 경우 http://n3015m.tistory.com/329 하단의 한글지원 설정을 참고


※ 참고 사이트

- Telegram on Raspberry Pi

  http://www.instructables.com/id/Telegram-on-Raspberry-Pi/

- 라즈베리 파이를 메시지 서버로!(TELEGRAM CLI)

  http://www.hardcopyworld.com/gnuboard5/bbs/board.php?bo_table=lecture_rpi&wr_id=7

Posted by n3015m
:

Last Updated 2016.06.10


라즈베리파이를 이용하여 외부에서 CCTV용도로 사용할 웹캠(Web Cam)을 연결하는 방법을 간략하게 정리합니다. 아래는 모두 라즈베리파이 3을 기준으로 작성되었습니다.



※ USB에 웹캠 연결 및 인식여부 확인하기


일단저는 집에 사용하지 않는 USB 웹캠이 있어서 새로 구입하지 않고 인식이 되는지 USB에 연결을 하였습니다.


lsusb를 통해서 웹캠이 인식되는지 확인을 해야합니다. 인식이 안될경우 어떻게 해야할지 난감한데 저는 운이 좋게 아래와 같이 잘 인식이 되네요.




※ motion 소프트웨어 설치 및 설정하기


- motion 설치

아직 초보라 어떤 소프트웨어가 적당한지 모르겠지만 인터넷에 많이들 motion을 소개하고 있어 저도 motion을 설치해 보았습니다.


sudo apt-get install motion



- motion 설정

일단 동일한 공유기에 라즈베리파이와 PC가 연결되어 있어, PC에서도 접속하려면 localhost로만 접속이 가능하게 하는 기능을 off하고 접속할 포트는 8080으로 정했습니다. 


sudo vi /etc/motion/motion.conf

- stream_localhost off로 변경

- stream_port 8080




- 영상 보기

일단 설정한 방식으로 하면 http://localhost:8080 으로 하면 영상이 나오게 됩니다. 다만 일부 브라우져는 호환이 안되고 있네요. 특히 IE의 경우 영상이 안보이고 파일이 다운로드 되는 화면이 나옵니다.


크롬이나 Raspberry Pi의 Default 브라우져로는 잘 보이네요.


http://localhost:8080


예제가 좋지 않네요. 원격지에서 접속한거라 ㅠㅠ 저희집 이불입니다. ㅠㅠ




※ 부팅시 자동시작 등록


sudo vi /etc/default/motion

- start_motion_daemon=yes




※ 기타 문제해결


설치 후 motion 데몬이 다운되어 접속이 안되는 현상이 빈번하게 있었습니다. 인터넷에 검색해 보니 전원이 부족하거나, 권한 문제 등이 확인되었으며 저는 아래와 같이 조치를 해봤습니다. 그래도 끊기는 문제가 있지만 다시 접속은 되네요.


- 전원 용량 부족으로 발생한 문제 완화

전원 공급이 가능한 USB 공유기를 구입해서 해결해야 됩니다.

주문 했으니 수령하면 후기 공유할게요.


저는 일단 USB전원을 사기 전까지 아래와 같이 조치하니 서버는 잘 죽지는 않았습니다. 다만 브라우져에서 중단되는 현상은 해결이 안되네요.


sudo vi /etc/motion/motion.conf

- output_pictures off



- 권한 문제인가 의심되는 경우

# Target base directory for pictures and films

# Recommended to use absolute path. (Default: current working directory)

target_dir /home/pi/motion


이 설정은 안해봐서 어느정도 해결되는 모르겠네요. 인터넷 사이트에서 봤는지 링크는 분실했네요.


- 영상 프레임을 빠르게

화면이 처음에는 2 frame으로 매우 답답하게 느껴집니다. 아래와 같이 조정하면 조금이라도 나아지니 참고 바랍니다.


sudo vi /etc/motion/motion.conf


# Maximum framerate for stream streams (default: 1)

stream_maxrate 10


# Maximum number of frames to be captured per second.

# Valid range: 2-100. Default: 100 (almost no limit).

framerate 10


여러가지 값으로 조정해 봤지만 10 이상은 차이가 없어 보입니다.



※ 참고 사이트

- [라즈베리파이 중급] (11) CCTV 만들기-1 

  http://echo.tistory.com/253

- [라즈베리파이 중급] (12) CCTV 만들기-2

  http://echo.tistory.com/254


Posted by n3015m
:

BLOG main image
'네오이즘'의 보안LAB 블로그입니다........... n3oism@gmail.com by n3015m

카테고리

분류 전체보기 (228)
[ HappyDevTool ] (29)
[ HappyToolRelease ] (4)
[Book] (6)
[ Security Studies ] (0)
- CII (2)
- BigData (2)
- Web Hacking (10)
- SQL Injection (25)
- Mobile Security (9)
- Network (6)
- OperatingSystem (4)
- Malware & Reversing (4)
- Phishing (5)
- Compliance (0)
- Programming (13)
- Tools (13)
- IoT (6)
- etc (21)
[Pentration Testing] (3)
[OS X] (4)
[ Security Trends ] (16)
[ Fixing Guideline ] (7)
My Way, My Life (34)
About Me (2)

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

Total :
Today : Yesterday :