Skip to content

Instantly share code, notes, and snippets.

@Achieve777

Achieve777/shell Secret

Created July 2, 2023 09:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Achieve777/5e02b951ad9a7703f8451a4c900cc87c to your computer and use it in GitHub Desktop.
Save Achieve777/5e02b951ad9a7703f8451a4c900cc87c to your computer and use it in GitHub Desktop.
自动获取验证码
#!/bin/bash
result=$(sqlite3 ~/Library/Messages/chat.db 'SELECT text FROM message WHERE datetime(date/1000000000 + 978307200,"unixepoch","localtime") > datetime("now","localtime","-60 second") ORDER BY date DESC LIMIT 1;')
name="验证码";
if [ ! $result ]; then
echo "latest not receive code messsages";
fi
if [[ "$result" =~ "$name" ]]; then
code=`echo $result | grep -o "\d\{4,6\}"`;
echo -n "$code";
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment