본문 바로가기
server/Cent_os

Telegram_cli를 이용한 centos cil 메신저 이용하기

1.Telegram_cli install

## 설치 OS :centos 6.6 64bit
## 참조 사이트 :https://github.com/vysheng/tg
## 설치 의존성을 위해 아래와 같이 의존성 패키지를 미리 설치 진행 한다.
[root@localhost ~]# yum install lua-devel openssl-devel libconfig-devel readline-devel libevent-devel libjansson-devel python-devel -y

## git clone 을 이용, 다운 및 해당 디렉토리로 이동 
[root@localhost ~]# git clone --recursive https://github.com/vysheng/tg.git && cd tg

## 다운 받은 소스를 설치 진행 한다.
[root@localhost tg]# ./configure --disable-json
[root@localhost tg]# make

## 설치 완료 후 별도 pre-fix 설정 없을 경우 해당 소스 디렉토리에 bin형태로 바이너리 파일을 확인 할 수 있으며
## 설치 디렉토리에 있는 server.pub 키를 이용하여 실행 한다.
[root@localhost tg]# cd bin
[root@localhost bin]# ./telegram-cli -k ../server.pub
change_user_group: can't find the user telegramd to switch to
Telegram-cli version 1.3.3, 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.0.3
Telegram-cli includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit. (http://www.openssl.org/)
Telegram-cli uses libpython version 2.6.6
I: config dir=[/root/.telegram-cli]

## 아래와 같이 자신의 핸드폰 번호를 입력 하려 인증을 진행 한다.
phone number: +821012341234 <--------------자신의 핸드폰 번호 입력 (한국 기준 010-1234-1234 > +821012341234

## 아래 국외발신으로 된 문자가 오는데 해당 코드를 입력 한다.

code ('CALL' for phone code): 72459




## 텔레그램 어플에서는 아래와 같이 해당 os의 아이피와 unix console 로그인을 확인 할 수 있다.




2.기본 설정 및 구성

## 위 설치 및 인증이 정상적으로 되었다면 아래와 같이 접속 확인이 가능 하다.
User 유저이름 online (was online [2016/03/03 22:08:07])
User 유저이름 offline (was online [2016/03/03 22:03:14])


## 메세지를 보내기 위해서는 상대의 정확한 이름을 확인 해야 하는데 
## conteact_list 명령어를 통해 이름들을 확인 가능 하다.

- conteact_list

## 명령어를 보내기 위해서는 아래와 같이 진행 하면 된다.
- msg <받을사람> <메시지>
(상대 이름에 띄어쓰기가 있을 경우 _ 로  하며, null 로 나와 있는 이름은 텔레그램 어플 혹은 프로그램을 이용하여
다른 이름으로 강제로 변경후 진행 해야 한다.

##아래 테스트 처럼 한글 및 간단한 문장에 대한 테스트가 가능 하다.

## 위 방법은 cli 프로세스에서 직접 보내야 하는 단점이 있지만 아래 처럼 
## 쉘 환경에서도 전송이 가능하며, 해당 커맨드를 응용하여, bash 스크립트 혹은 다른 스크립트 언어를 이용하여 발송이 가능 하다.


[root@localhost bin]# ./telegram-cli -k ../server.pub -W -e "msg [사용자이름]  쉘에서 전송" > /dev/null   




## 폰에서 확인시 아래와 같이 확인 가능 !



## 서버에 사진 파일이 있을 경우 아래와 같이 사진 전송이 가능 하다.
- send_photo <받을사람> <파일명> 






반응형

'server > Cent_os' 카테고리의 다른 글

httpry를 이용한 All HTTP Requests Monitor툴  (0) 2016.03.12
cent os local_port_range 확장  (0) 2016.03.12
ModSecurity (owasp core rule) setting  (0) 2015.05.27
centos nat lvs구성  (0) 2015.05.27
geo-ip setting  (0) 2015.05.27