一,fiche 安裝
可以通過官方提供的服務使用fiche,但為了信息安全不建議這么做。
從github下載fiche代碼,
2.1 編譯安裝
$ cd fiche
$ make
$ sudo make install
2.2 源碼定制
可以修改源碼,將最新內容輸出到0000頁面,將log輸出到ffff頁面。
diff --git a/fiche.c b/fiche.c
index 99d140d..3597242 100644
--- a/fiche.c
+++ b/fiche.c
@@ -462,6 +462,10 @@ static int start_server(Fiche_Settings *settings) {
print_status("Server started listening on: %s:%d.",
settings->listen_addr, settings->port);
print_separator();
+ if(create_directory(settings->output_dir_path, "0000") != 0 ||
+ create_directory(settings->output_dir_path, "ffff") != 0) {
+ print_error("Create directory error!");
+ }
// Run dispatching loop
while (1) {
@@ -640,7 +644,8 @@ static void *handle_connection(void *args) {
// Save to file failed, we have to finish here
- if ( save_to_file(c->settings, buffer, slug) != 0 ) {
+ if ((save_to_file(c->settings, buffer, "0000") != 0)
+ || (save_to_file(c->settings, buffer, slug) != 0)) {
print_error("Couldn't save a file!");
print_separator();
2.3 設置系統服務并啟動
``
$ sudo vim /lib/systemd/system/fiche.service
[Unit]
Description=FICHE-SERVER
[Service]
ExecStart=/usr/local/bin/fiche -d your.ip:9998 -o /var/www/fiche -l /var/www/fiche/ffff/index.txt -u root -B 6553600
[Install]
WantedBy=multi-user.target
$ sudo systemctl daemon-reload
$ sudo systemctl enable fiche
$ sudo systemctl restart fiche
$ alias tb="nc localhost 9999"
二,nginx安裝
可以配置成本地ip或者公網ip和指定端口
$ sudo apt install nginx
$ vim /etc/nginx/sites-enabled/fiche
server {
listen 9998;
server_name your.ip:9998;
charset utf-8;
location / {
root /var/www/fiche/;
index index.txt index.html;
}
}
$ sudo systemctl restart nginx
三, 使用
可以將nc或者curl命令將終端輸出內容上傳到fiche服務, 會返回一個http地址,可以通過網頁或者curl命令直接查看內容。
$ dmesg | nc localhost 9999
$ dmesg | curl --data-binary @- localhost:9999
上傳剪切板內容
$ xclip -o | nc localhost 9999