[SMBv1] check-smbv1-all.sh

No Comments

#!/bin/bash
class=$1
if [ -z $1 ]; then
        echo "No Network Set"
        exit 0
else
        cd /opt/scripts/SMBv1
        for classC in $(seq 0 255)
        do
                # set LAN range to check
                classc="$1"."$classC"
                network2check=`echo $classc.0\/24`

                # build check list, list the ip is opened port 445
                # 建議用其他程式取得, 開啟445的IP, 用nmap 太傷
                echo $network2check
                /bin/bash /opt/scripts/SMBv1/checking-ip2check.sh $network2check
                #lan2check=`echo $classc.0`
                list2check=`echo "$classc".0_slash_24-alive-ip.list`

                # check ip from list if it/them has/have smbv1 issue
                if [ -s "$list2check" ]; then
                        /bin/bash /opt/scripts/SMBv1/checking-smbv1-devices-need-iplist.sh $list2check
                else
                        #echo "No Host to check." > $list2check
                        rm -f $list2check
                fi

                # wait 2 mins, then run the next round
                echo "sleep for 1 seconds..."
                sleep 1

        done
        # set header
        sed -i -e 's/,,,/IP,OS Version,NetBIOS,FQDN/' ./data/*.csv
        exit 0
fi

Windows 網芳(未掛網路磁碟), 清除目前的登入狀態

No Comments

REF: http://dreamtails.pixnet.net/blog/post/28339192

登入網路芳鄰後,如何更改帳號再登入?
分享: facebook PLURK twitter
step 1)
$ net use * /del /y
(將所有網路芳鄰驗證的cache清除)
step 2)
更換其他帳號登入網路芳鄰即可

註: 也可以使用指令的方式做驗證! 如下:
指令格式: net use \\<網路芳鄰IP位址>\share /USER:\

$ net use \\192.168.10.1\share /USER:Taiwan\Root

[logstash][geoip] 以public-IP取代priveate-IP

No Comments

為了統計上的便利, 並取得全面性的資料樣態
需要把內部IP轉化為數據群體的一部分

在 logstash 設定的方法如下,

if [clientip] and [clientip] !~ "(^127\.0\.0\.1)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^192\.168\.)|(^169\.254\.)" {

            geoip {
                database => "/opt/logstash-2.2.2/GeoLiteCity.dat"
                source => "clientip"
                target => "geoip"
                add_field => [ "[geoip][coordinates]", "%{[geoip][longitude]}" ]
                add_field => [ "[geoip][coordinates]", "%{[geoip][latitude]}"  ]
            }
else {
           mutate {
                add_field => [ "lanip" => "real-public-ip-here" ]
                }
           geoip {
                source => "lanip"
                target => "geoip"
                add_field => [ "[geoip][coordinates]", "%{[geoip][longitude]}" ]
                add_field => [ "[geoip][coordinates]", "%{[geoip][latitude]}"  ]
                }
          mutate {
                remove_field => [ "lanip" ]
                }
        }

以上設定能將內部IP轉為外部IP

關於 \r\n 以及^M 的一些事

No Comments

在 vim 環境下, 顯示出 ^M 符號
https://superuser.com/questions/97692/vim-show-line-feeds-carriage-return

【轉貼】\r\n和\n的差異
http://seacatcry.pixnet.net/blog/post/13732061

利用 rsync 備份資料的相關資訊

No Comments

利用 rsync daemon 方式, 密碼以檔案方式載入
http://tnrc.ncku.edu.tw/course/93/fedora_core2/page15/p15.htm

;rsync -a --password-file=/root/scripts/rsync-sec /opt/alfresco-community/ sopadmin@IP:[port]:Public/alfresco-community/

如果是已經透過 NFS/CIFS 掛載目錄
就直接 rsync -a /source-dir /distination-dir

—- updated —-
http://blog.xuite.net/csiewap/cc/59463116
《使用 rsync 實做重複資料刪除技術 差異備份 版本控制 增量備份》

去除文件裡的 ^M 特殊符號

No Comments

一般 ^M 符號是出現在每行的最後
這時可利用 dos2unix 指令來解決會比較簡單

但偶有情況是出現在行中, 而不是在行尾/行末
這時 dos2unix 就會處理不到

這時要改用以下網頁的方法

http://dragonspring.pixnet.net/blog/post/33146613

sed  "s/\r//" dos_file  > dos_file_linux

或是

tr -d "\r" < dos_file  > dos_file_linux

NextVOD 網樂通安裝 Debian wheezy, 增加 apt source

No Comments

deb [arch=all] http://ftp.tw.debian.org/debian/ wheezy main contrib non-free
deb [arch=all] http://ftp.tw.debian.org/debian/ wheezy-proposed-updates main contrib non-free
deb [arch=all] http://ftp.tw.debian.org/debian/ wheezy-backports main contrib non-free
deb [arch=sh4] http://www.si-linux.co.jp/pub/debian-sh/wheezy-sh4 wheezy main
deb [arch=sh4] http://download.si-linux.co.jp/debian-sh/wheezy-sh4 wheezy main contrib non-free
deb http://ftp.yzu.edu.tw/Linux/debian-sh4-for-nextvod/ wheezy all

REF:
https://ftp.yzu.edu.tw/Linux/debian-sh4-for-nextvod/download.php
http://ftp.yzu.edu.tw/Linux/debian-sh4-for-nextvod/dists/wheezy/all/binary-sh4/

Older Entries Newer Entries

Share via
Copy link