[AppleScript]SHA-1 ダイジェストを確認
SHA-1 ダイジェストを確認する方法はこちら[LINK]に
記載された方法です。
SHA-1 ダイジェストを確認する必要性
さほどナーバスになる必要もないけれど
もしも『ホームページが改ざん』されていたり
ファイルが破損していたりする事があります。
それをファイルを開く前に確認する事で
不正なファイルを実行してしまう可能性を潰します。
Apple等も『全てのファイル』に対してSHA-1 ダイジェストは記載していません
セキュリティ上重要と思われるファイルには記載していますので
企業等で管理している場合は
SHA-1 ダイジェストを確認する習慣を身に着けたいものです。
習慣になればさほど面倒でもありません。
SHA-1 ダイジェストは↓のように記載されています。
tell application "Finder"
activate
display dialog "SHA 1 digestをペーストしてください" default answer the "1234567890123456789012345678901234567890"
set SHA to text returned of the result as Unicode text
end tell
tell application "Finder"
activate
choose file default location (path to downloads folder) with prompt "ダウンロードしたファイルを選択してください" without multiple selections allowed
set Objresult to the result as alias
----UNIX形式のファイルパスへ変更
set ObjPath to POSIX path of Objresult
end tell
---コマンド
set SHAfile to "/usr/bin/openssl sha1 " & ObjPath as text
---コマンド実行
set SHAfilecom to (do shell script SHAfile without administrator privileges)
----文字数を数える
set CntSHAfilecom to the length of characters of SHAfilecom
set CnttheAlias to the length of characters of ObjPath
---SHAを抜き出す
set SHAfileID to characters (CnttheAlias + 9) thru (CntSHAfilecom) of SHAfilecom as Unicode text
tell application "Finder"
activate
---比較判定
if SHA is equal to SHAfileID then
display dialog "SHA値は一致しました" default answer SHAfilecom
else
display alert "一致しませんでした再度ダウンロードしてください" as warning
end if
end tell
SHA1=16cdbe526165fd9cc8001c1a1444a9f4962cf4d7
「SHA.zip」をダウンロード[LINK]
| 固定リンク
「Security」カテゴリの記事
- Symantec Endpoint Protection (SEPRemote)(2021.07.06)
- 【AppleScript】Symantec Endpoint Security 14.3 RU2(2021.07.02)
- 情報セキュリティ10大脅威 2021(2021.01.30)
- [zoom]MacRetinaRes.zip(2020.04.26)
- 【無料】Sophos Anti-Virus for Mac Home Edition(2015.05.30)
この記事へのコメントは終了しました。
コメント