今天得到的教訓是,一個不會寫 Ruby 的人,就不應該去寫生產環境的 Ruby …

原寫法

for ip in ec2_urls do
puts(“#{ip}”)
end

$ ruby api.rb
10.24.1.177
10.24.2.93
10.24.1.177
10.24.2.93

指正後

ec2_urls.each do |ip|
puts(“#{ip}”)
end

$ ruby api.rb
10.24.1.177
10.24.2.93

Upgrading simple shells to fully interactive TTYs

Every pentester knows that amazing feeling when they catch a reverse shell with netcat and see that oh-so-satisfying verbose netcat message followed by output from id.

And if other pentesters are like me, they also know that dreadful feeling when their shell is lost because they run a bad command that hangs and accidentally hit “Ctrl-C” thinking it will stop it but it instead kills the entire connection.

https://blog.ropnop.com/upgrading-simple-shells-to-fully-interactive-ttys/

踩了個挺沒面子的坑,分享一下。

給某網站做的 CDN 服務器,不知道為什麼複製粘貼的配置全是 proxy_cache_valid any 30d;

然後就一直有一些不大不小的問題,比如明明存在的文件卻變成了 404 …

今天終於搞懂了 proxy_cache_valid 原來是靠狀態碼緩存的(我一直以為 proxy_cache_revalidate on; 不會讓這種問題發生 ),也就是還未上傳的文件被訪問了一次的話 30 天就別想訪問了 Orz…

現在改成這樣了:

proxy_cache_valid 200 30d;
proxy_cache_valid 404 1m;