TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Made a quick filesharing bash script inspired by another Show HN post

2 点作者 sanroot99超过 2 年前
I got inspiration from this post https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=33094627<p>Here is the script<p>#!&#x2F;bin&#x2F;bash qrcode() {<p><pre><code> qrcode-terminal &quot;http:&#x2F;&#x2F;&quot;$(ip addr show wlp3s0 |grep -Eo $ipregex |head -n1 )&quot;:9000&#x2F;&quot; cd ~&#x2F;.webshare &amp;&amp; python3 -m http.server 9000 </code></pre> } share()<p>{ if [[ &quot;$1&quot; = &quot;f&quot; ]] then echo &quot;success $1&quot;<p><pre><code> [[ ! -d ~&#x2F;.webshare ]] &amp;&amp; mkdir -p ~&#x2F;.webshare #cp -r --reflink &quot;$2&quot; ~&#x2F;.webshare&#x2F; path=&quot;$(realpath &quot;$2&quot;)&quot; ln -s &quot;$path&quot; &quot;&#x2F;home&#x2F;sanbotbtrfs&#x2F;.webshare&#x2F;&quot; qrcode</code></pre> elif [[ &quot;$1&quot; = &quot;s&quot; ]] then path=&quot;$( find &quot;$2&quot; |fzf )&quot; path=&quot;$(realpath &quot;$path&quot;)&quot; ln -s &quot;$path&quot; &quot;&#x2F;home&#x2F;sanbotbtrfs&#x2F;.webshare&#x2F;&quot; qrcode else error fi }<p>cleanup() { echo &#x27;cleanup operation &#x27; rm -vrf ~&#x2F;.webshare&#x2F;* } error() { echo &#x27;usage share [s&#x2F;f] &lt;filename&#x2F;dir&gt; ; s is for fuzzy search and f is regular &#x27;<p>} trap cleanup 1 2 3 6 14 15 ; [[ $# -eq 2 ]] &amp;&amp; share &quot;$1&quot; &quot;$2&quot; || error

1 comment

incomingpain超过 2 年前
python3 -m http.server 9000 does all the heavy lifting.<p>What is interesting is the qrcode-terminal. Never seen that before but makes me wonder. In terms of data exfiltration, you could absolutely store data inside a qrcode.<p>Looked it up, qrcodes can store about 4000 characters. I guess in situations where node is available it could be useful
评论 #33111024 未加载