Total Pageviews

Monday 3 June 2013

jTorChat:基于Java的Torchat加密聊天工具



jTorchat是Java的torchat,这个jTorchat是完全重写的一个P2P即时通Torchat工具.

jTorchat官方项目地址:https://code.google.com/p/jtorchat/

官方下载:
http://jtorchat.googlecode.com/files/JTorchat-dist-201201161122.zip

说明:jtorchat 与 torchat并没有依赖关系,可以认为是二个独立的工具,使用jtorchat需要系统安装有Java.

Windows系统的使用方法:

下载后将文件解压到一个文件夹中,如jtorchat文件夹

1、进入文件夹jTorChat。
2、运行jTorChat.jar
3、tor初始化后,会看到一个设置菜单,简单设置如下:
3.1 Profile-name:这里输入你的昵称。最好匿名不使用自己的真实姓名。
3.2 Profile-text:在这里你可以写上介绍自己话语。可以不必填写。
3.3 在advanced下,还可以设置Tor的配置,如下:
3.3.1 Tor socks port:在这里,设置你的Tor服务侦听的端口。如果使用下载的便携式Tor的jTorChat,使用默认的设置即可。
3.3.2 Local Port:你可以设置任何未使用的端口,而不是8975。
3.3.3 Our ID:这是你的Tor的隐匿服务的地址。如果你用另一个TOR,只要编辑这个即可。
3.3.4 Load Tor:如果你要使用便携jTorChat中的tor,不需要设置。
4、按菜单”文件”下”Request Buddies” 既是”请求朋友”。
----------------------------------

torchat:基于tor的简易加密聊天工具



torchat 是一个p2p的基于tor的加密聊天工具,界面非常简单,可以用于翻墙一族和需要更高安全要求的人士的文字聊天和传送文件。torchat通过Tor的隐藏服务实现点对点聊天的加密通讯,点对点聊天,内容不受第三方的监视或过滤。Tor可以加密聊天内容,Tor隐藏服务可以隐藏使用者的IP。

一、torchat官方项目主页

https://code.google.com/p/torchat/

二、torchat最新版官方下载

2011-11-11 更新 torchat-windows-0.9.9.550
torchat-windows-0.9.9.550.zip
SHA1:cdb24a2913ae8e4528dd3fbf0a27a90097542ad5

三、torchat的特点

1、可以文字聊天,还可以传送文件;
2、取消聊天记录,窗口关闭内容即永久消失,保密性强,但没有发出的信息会保存
3、使用隐藏服务,隐藏IP,保护隐私
4、点对点聊天,不经第三方明文中转不受监控或过滤,不存在服务器宕机。在对方你想情况下不能留言,
5、便携版,方便使用,解压官方下载包即可使用。注意:不要删除torchat文件夹中的文件,便携版使得文件都保存在此文件夹中,随意删除可能导致文件保存在电脑中。torchat 文件夹内含有用户隐藏服务的身份密钥,他人获得后身份可能被盗用。

缺点:隐藏服务启动较慢,内网好象是不能使用。

四、使用torchat

torchat 使用隐藏服务,使用者的ID,在第一次启动时会自动生成,一个16位的数字字母随机组合,保存在hidden_service文件夹中,在torchat启动后的窗口中也可以看到。

1. 下载官方 torchat 压缩包,解压,
2. 启动 torchat.exe 后,联系人列表中会自动生成一个16位数字字母随机组合的ID,显示为一个不在线的联系人(myself),这就是你自己的ID。
在它的右键菜单里选择编辑联系人(Edit Contact...),可以复制出你的ID,然后就可以删除自己(delete Contact...),将这个ID以某种方式告诉你的朋友。

3. 添加、删除、更改好友
收到朋友的ID后在列表的空白部分点右键,选择菜单里的添加联系人Add Contact...,在弹出的对话框里torchat ID中填入收到的ID,将联系人的名字填入好友名称Display Name,Introduction里是对方将收到的来自你的第一条消息。然后点确认OK。
删除好友时,在对应好友的右键菜单里选择删除联系人Delete Contact...,并选择[是]确认。
修改好友名称时在对方的右键菜单里选择编辑联系人Edit Contact...,在Display Name里输入合适的名称。

4. 开始使用:
Tor的隐藏服务上线很慢。需要耐心等待,直到对方图标变绿色后才可以聊天。 最好的方法是双击对方图标随便输入一些话,关闭聊天窗口(不要隐藏好友列表,否则可能崩溃|Bug)。待对方上线后torchat会提示你消息已发出,这时就可以正常聊天了。

5. 传文件:在对方图标的右键菜单中选发送文件Send File...

6. 查看清除离线消息

torchat属于点对点聊天,没有时刻在线的中间服务器,所以不存在离线消息。这里所谓的离线消息是个待发送消息队列,所有没有发送成功的消息都会进入这个队列等待发现对方上线后再发送给对方。 在对应好友的右键菜单中可以查看待发送消息Show Queued Offline Message,或删除待发送消息Clear Queued Offline Message。注意:这个文件保存在toechat文件夹中,文件名为:你的ID_offline.txt ,如果是敏感信息,要记的删除之。
--------

Torchat client using C and mongoose.

TORchat

A simple chat client for the TOR network. Inspired by TorChat. It is written in C and C++.

Warning

We are currently redesigning the torchat protocol from the bottom up. This should be considered a working but not final version.

More on docs branch.

Status

This is a work in progress. TORchat should be stable enough to hack on and test, but has not been tested in production or for any length of time.

Breaking changes are frequent and stability is not guaranteed at current time.

Features

TORchat is an experimental P2P chat client that runs on the TOR network and allows you to:

  • chat securely with other peers on the network
  • send messages without leaving the TOR network
  • chat without exposing your identity (or IP address)

How it works

TORchat is a peer-to-peer instant messaging system built over the TOR Network hidden services. Your identity is your hidden service address, and contacts connect to you without leaving Tor. The rendezvous system makes it extremely hard for anyone to learn your identity from your address.

Try it

At the current state, the various torrc values are embedded onto .c files. Later options and a shell script will be provided for that.

Move into the TORchat folder and compile:

git clone http://francescomecca.eu:3000/pesceWanda/torchat

Or, if you preferer

git clone https://github.com/framecca/torchat

Then

cd torchat

bash install.sh

Now start tor with the provided torrc

tor -f tor/torrc

In case TOR complains about folder permission do chmod 700 ./tor to set the appropriate permissions.

Now start the server

./build/main 8000

The server listens for incoming connection from the port 8000. TOR redirects the traffic from port 80 of the hidden service to the server, trasparently.

Your peer id is:

cat tor/hostname

As a client, you can use this.

Design

TORchat uses standard JSON messages for communication plus a size indentifier.

TORchat is divided into a daemon and a client completely independent of each other. The daemon continuosly runs and gathers messages from other peers and stores them in a volatile hash table (and logs, if configured accordingly). The client may connect at any time, read the received messages and chat with peers. The client send commands to the server using JSON. For a list of possible commands, check the Development section

Building

TORchat requires a C++11 compatible compiler. To build the standard version (including debug and logging because it is still not a stable) , simply run:

cmake .

make

Usage

At the moment the only command line option that is provided is the daemon mode:

./build/main -d 8000

Without daemon mode, the server keeps logging on standard output (that is, on the current shell). With the daemon mode option, it detaches from the shell and continues its execution in background, therefore it can be monitored only through logs, which are kept in the main directory of the repository.

Development

Daemon

The daemon aims to be as small as possible. Currently it supports only Linux and aims to do so.

The daemon uses a combination of epoll plus libdill to manage events, TOR as a socks5 proxy, loguru to mantain logs, json for communication and proxysocket to initialize the socks5 proxy connection.

The core of the daemon is written in C with bindings to embedded libraries in C++.

Until the exit procedure is called, the daemon waits for messages from peers or clients (event_poll) and acts accordingly to the JSON received.

An hash tableis mantained and used to store all the unread messages from the peers. As soon as a client connects, the read messages are removed from the hash table.

The daemon only mantains two logs: one for the messages, one for the errors. Separate functions which enable to parse and divide the logs are provided.

There is an ongoing discussion about the possibility of adding encryption (maybe OTR) on top of the TOR layer.

Client

Clients are independent of the daemon. To work properly, a "basic" client must be:

  • Capable of sending messages though sockets
  • Capable of parsing a JSON structure

Currently a small python client is provided here. It is based on curses, specifically on the ui from: calzoneman/python-chatui. To use it, move to the repository main directory and:

python3 client.py localhost 8000

localhost can be replaced with any other host on which the TORchat daemon is running.

It will ask for a peer (an onion address) to connect with, and then it will support the following actions:

  • To write a message to the peer selected, simply write and press enter;
  • To send a command to the client/server and perform specific actions, head to the command table provided below. Commands are all preceded by a '/' sign.
CommandAction
/peerChange the current peer.
/exitClose the client and the server.
/quitClose the client only.

JSON

JSON is used for communication, both IPC and sockets. One possible JSON may be:

/*
 * json j = {
 * {"date" = "31-10-2016"}, // not always used
 * {"cmd" = SEND},
 * {"portno" = 80},
 * {"id" = "ld74fqvoxpu5yi73.onion" },
 * {"msg" = "Alice says hi"}
 * }
 */

The cmd field is a set of standard commands understood by the daemon that execute different tasks based on that command. Some commands can only be sent from a client on the same host, not from a peer. Commands are:

  • SEND : the client is trying to reach for a peer ("id" field, "port" field) and send him a message ("msg" field);
  • RECV : a peer ("id" field) has contacted the daemon and sent him a message. Store it in the hash table until it is read;
  • UPDATE : the client is polling for unread messages from a peer ("id" field);
  • GET_PEERS : the client asks the daemon for the id of the peers that wrote one or more messages;
  • HISTORY : the client is asking the daemon for the previous n ("msg" field) lines of conversation with a peer ("id" field); // to be implemented
  • HOST : the client is asking the daemon for the current hostname, that is, its current onion address;
  • END : the daemon notifies that the previous command has succeded and that communication can end;
  • EXIT : starts exit procedure (clean datastructs and exit cleanly).
  • ERR : in case TOR can't send the message or there is a sock failure, it reports the error;
  • FILE... : there are 4 enum values relative to the file upload process, which are exchanged between the servers and the client requesting an upload. // to be implemented

The date field is used only when the daemon communicates with the server. It must not be used when sending message between different hosts.

Protocol

TORchat uses raw tcp packets for communication. They are prefixed with a char lenght[4] that specifies the dimension of the message that is being sent. The daemon rejects every message that hasn't got a char[4] message size specifier padded from left(e.g.: 0084{...content of json...}).

Coroutines

TORchat by design uses structured concurrency because there isn't a real need for thread parallelism. When epoll detects action in a socket, the main event loop launches a coroutine that yields only when waiting for TOR to successfully open a connection with the endpoint (the other peer's daemon in this case).

Given that sometimes the connection to the endpoint may take up to two minutes, a real thread is spawned in order to estabilish the connection.

from https://github.com/FraMecca/torchat