Skip to content
Snippets Groups Projects
Commit 6a451e04 authored by Recolic's avatar Recolic :house_with_garden:
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 831 additions and 0 deletions
test
ip.txt
cloudflare.log
cloudflare.ids
nohup.out
fish_variables
__pycache__
config/vim/.netrwhist
.netrwhist
recolic.net-mirrors-sync-dev/mirrors/recolic-aur/*
test.exe
*.git-ignored
LICENSE 0 → 100644
BSD 2-Clause License
Copyright (c) 2024, Recolic
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// ==UserScript==
// @name Microsoft auto login
// @namespace https://recolic.net/
// @version 0.10.2
// @description Login MS account by simulating user interaction. Works for microsoft CORP account, works perfectly with automatic 2-step phone auth.
// @author Recolic Keghart <root@recolic.net>
// @license MIT
// @copyright 2024, recolic (https://openuserjs.org/users/recolic)
// @match https://login.microsoftonline.com/*
// @match https://msft.sts.microsoft.com/adfs/*
// @grant GM.xmlHttpRequest
// @run-at document-idle
// @updateURL https://openuserjs.org/meta/recolic/Microsoft_auto_login.meta.js
// ==/UserScript==
(function() {
'use strict';
var MY_EMAIL = 'YOUR_ALIAS@microsoft.com';
var MY_PASSWORD = 'YOUR_PASSWORD';
var MS_MODE = 202403;
// Only for Mode 202307. Download voice-to-text result through this API.
var PHONE_RECOG_API = 'https://XXX.net/api/logs/telnyx-text.php';
// Only for Mode 202403. Send msauth notification information through this API.
var MSAUTH_APP_API = 'http://msauth.XXX.xbs:30410/';
// Mode 2022 : Answer the phone, and type your PIN plus # key. It's still being used by some old MSFT page.
// Mode 202307: Answer the phone, press # key, listen for verification code, put verification code into file, and download through PHONE_RECOG_API.
// Mode 202308: Answer the phone, press # key, done.
// Mode 202311: Answer the phone, press # key, done.
// have different web frontend compared with 202308
// Mode 202403: Need to type a 2-digits number on Microsoft Authenticator app notification, done.
//
// How to deploy phone backend for 2022,202307,202308,202311: https://git.recolic.net/-/snippets/27
// How to deploy msauth_app backend for 202403: https://git.recolic.net/-/snippets/28
////////////////////////////////////////////
function is_pick_an_account_page () {
try {
var cn = document.getElementById('loginHeader').childNodes;
for(var i=0;i<cn.length;++i) {
if(cn[i].innerHTML == "Pick an account")
return true;
}
return false;
} catch {
return false;
}
}
function do_pick_an_account_page () {
var col = document.getElementsByClassName("table");
var found = false;
for(var i=0; i<col.length; ++i) {
if(col[i].getAttribute('data-test-id') == MY_EMAIL) {
col[i].click(); // goto next page
found = true;
break;
}
}
if(!found) {
// click use other account
console.log('Account not found. click use another account...');
for(var i=0; i<col.length; ++i) {
if(col[i].getAttribute('aria-labelledby') == 'otherTileText') {
col[i].click(); // goto next page
break;
}
}
}
}
function is_signin_email_page () {
try {
return document.getElementsByName('loginfmt').length == 1 && document.getElementsByName('loginfmt')[0].getAttribute('type') != 'hidden';
} catch {
return false;
}
}
function do_signin_email_page () {
if (document.getElementById('loginHeader') != null && document.getElementById('loginHeader').innerHTML.includes('Enter password')) {
// 202406 update: password input moved here
document.getElementById('i0118').value = MY_PASSWORD;
document.getElementById('i0118').dispatchEvent(new Event("change"))
document.getElementById('idSIButton9').click();
return;
}
document.getElementsByName('loginfmt')[0].value = MY_EMAIL;
document.getElementsByName('loginfmt')[0].dispatchEvent(new Event("change"));
document.getElementById('idSIButton9').click();
}
function is_signin_email_page_2 () {
try {
if (document.getElementById('loginMessage').innerHTML != 'Sign in')
return false;
return document.getElementById('usernamePage').style['display'] == 'block';
} catch {
return false;
}
}
function do_signin_email_page_2 () {
document.getElementById('userNameInput').value = MY_EMAIL;
document.getElementById('userNameInput').dispatchEvent(new Event("change"));
document.getElementById('nextButton').click();
}
function is_request_variants_page () {
try {
return false ||
document.getElementById('idDiv_RemoteNGC_PageDescription').innerHTML.includes('We sent a sign in request to your Microsoft Authenticator app') ||
document.getElementById('idDiv_RemoteNGC_PageDescription').innerHTML.includes("We couldn't send a notification to your phone at this time.") ||
document.getElementById('idDiv_RemoteNGC_PageDescription').innerHTML.includes("We'll send a sign-in request to your phone to sign in") ||
document.getElementById('idDiv_RemoteNGC_PageDescription').innerHTML.includes("Open your Authenticator app, and enter the number shown to sign in.");
} catch {}
try {
return document.getElementById('idDiv_RemoteNGC_PollingDescription').innerHTML.includes("Open your Authenticator app, and enter the number shown to sign in.");
} catch {
return false;
}
}
function do_request_variants_page () {
document.getElementById('idA_PWD_SwitchToCredPicker').click();
}
function is_pre_request_page () {
try {
var col = document.getElementsByClassName('text-block-body');
for(var i=0;i<col.length;++i) {
if(col[i].outerText.includes("We'll send a sign-in request to your phone to sign in"))
return true;
if(col[i].outerText.includes("Your organizational policy requires you to sign in again after a certain time period."))
return true;
}
return false;
} catch {
return false;
}
}
function do_pre_request_page () {
return do_request_variants_page();
}
function is_choose_a_way_page () {
try {
return document.getElementById('loginHeader').innerHTML == "Choose a way to sign in";
} catch {
return false;
}
}
function do_choose_a_way_page () {
var col = document.getElementsByClassName("table");
var found = false;
for(var i=0; i<col.length; ++i) {
if(col[i].innerHTML.includes("Use my password")) {
col[i].click(); // goto next page
found = true;
break;
}
}
if(!found) {
// click use other account
console.log('Error: Use my password element not found. DOing nothing');
}
}
function is_sts_auth_options_page () {
try {
return document.getElementById('primaryOptionsPage').style['display'] == "block";
} catch {
return false;
}
}
function do_sts_auth_options_page () {
try {
document.getElementById('WindowsAzureMultiFactorAuthentication').click();
} catch {
console.log('You should not reach here. The next codeline will be removed because it should be useless. ');
document.getElementById('FormsAuthentication').click();
}
}
function is_sts_pswd_input_page () {
try {
return document.getElementById('passwordPage').style['display'] == "block";
} catch {
return false;
}
}
function do_sts_pswd_input_page () {
document.getElementById('passwordInput').value = MY_PASSWORD;
document.getElementById('submitButton').click();
}
function is_sts_2fa_page () {
try {
return document.getElementById('mfaGreeting').classList.contains('hidden') && document.getElementById('mfaGreetingDescription').innerHTML == "For security reasons, we require additional information to verify your account";
} catch {
return false;
}
}
function do_sts_2fa_page () {
console.log("do_sts_2fa_page: Assuming you are using automated phone auth. (Setup a twilio account to automatically answer the phone and type PIN). This is the only possible & easy automated login way! ")
document.getElementById('WindowsAzureMultiFactorAuthentication').click();
}
function is_202308_2fa_select_page () {
if(MS_MODE != 202308) return false;
var col = document.getElementsByClassName("table");
for(var i=0; i<col.length; ++i) {
if(col[i].getAttribute('data-value') == "TwoWayVoiceMobile") {
return true;
}
}
return false;
}
function do_202308_2fa_select_page () {
var col = document.getElementsByClassName("table");
var found = false;
for(var i=0; i<col.length; ++i) {
if(col[i].getAttribute('data-value') == "TwoWayVoiceMobile") {
// first phone call. click it.
col[i].click();
found = true;
break;
}
}
if(!found) {
console.log('Error: new 2fa, table element with TwoWayVoiceMobile not found. DOing nothing');
}
}
function is_202308_2fa_verify_page () {
if(MS_MODE != 202308) return false;
var ele = document.getElementById('idDiv_SAOTCC_Description');
if (ele == null) return false;
return ele.innerHTML.includes('re calling your phone');
}
function do_202308_2fa_verify_page () {
var eleerr = document.getElementById("idSpan_SAOTCC_Error_OTC");
if(eleerr != null && eleerr.innerText.includes("We called your phone but didn't receive the expected response")) {
document.getElementById("signInAnotherWay").click();
}
}
function is_202311_2fa_select_page () {
if(MS_MODE != 202311) return false;
var col = document.getElementsByClassName("table");
for(var i=0; i<col.length; ++i) {
if(col[i].getAttribute('data-value') == "TwoWayVoiceMobile") {
return true;
}
}
return false;
}
function do_202311_2fa_select_page () {
var col = document.getElementsByClassName("table");
var found = false;
for(var i=0; i<col.length; ++i) {
if(col[i].getAttribute('data-value') == "TwoWayVoiceMobile") {
// first phone call. click it.
col[i].click();
found = true;
break;
}
}
if(!found) {
console.log('Error: new 2fa, table element with TwoWayVoiceMobile not found. DOing nothing');
}
}
function is_202307_2fa_select_page () {
if(MS_MODE != 202307) return false;
var col = document.getElementsByClassName("table");
for(var i=0; i<col.length; ++i) {
if(col[i].getAttribute('data-value') == "OneWayVoiceMobileOTP") {
return true;
}
}
return false;
}
function do_202307_2fa_select_page () {
var col = document.getElementsByClassName("table");
var found = false;
for(var i=0; i<col.length; ++i) {
if(col[i].getAttribute('data-value') == "OneWayVoiceMobileOTP") {
// first phone call. click it.
col[i].click();
found = true;
break;
}
}
if(!found) {
console.log('Error: new 2fa, table element with OneWayVoiceMobileOTP not found. DOing nothing');
}
}
function is_202307_2fa_verify_page () {
if(MS_MODE != 202307) return false;
var ele = document.getElementById('idDiv_SAOTCC_Description');
if (ele == null) return false;
return ele.innerHTML.includes('re calling your phone');
}
var txt_prev_elecount="";
function do_202307_2fa_verify_page () {
var elecount = document.getElementById('idDiv_SAOTCC_Title');
if (elecount.innerText == "Enter code") {
elecount.innerText = "3";
return;
}
if (elecount.innerText == "3") {
elecount.innerText = "2";
return;
}
if (elecount.innerText == "2") {
elecount.innerText = "1";
return;
}
if (elecount.innerText == "1") {
elecount.innerText = "fetching API result";
return;
}
var eleerr = document.getElementById("idSpan_SAOTCC_Error_OTC");
if(eleerr != null && eleerr.innerText.includes("You didn't enter the expected verification code.")) {
// 6 digits code is incorrect.
if (txt_prev_elecount == elecount.innerText) {
// give up
document.getElementById("signInAnotherWay").click();
}
else {
// Maybe transcript is incomplete yet. Wait for another round and see if elecount still change.
txt_prev_elecount = elecount.innerText;
}
}
// First 3 calls, don't do anything. wait for the phone call to complete.
// From the 4th call, fetch the result.
GM.xmlHttpRequest({
method: "GET",
url: PHONE_RECOG_API,
onload: function(response) {
var elecount = document.getElementById('idDiv_SAOTCC_Title');
var apitext = (response.responseText);
elecount.innerText = apitext;
var apitext_cleaned = apitext.replace(/one/ig, '1').replace(/two/ig, '2').replace(/three/ig, '3').replace(/four/ig, '4').replace(/five/ig, '5').replace(/six/ig, '6').replace(/seven/ig, '7').replace(/eight/ig, '8').replace(/nine/ig, '9').replace(/zero/ig, '0').replace(/to/ig, '2').replace(/for/ig, '4').replace(/sex/ig, '6');
var elein = document.getElementById('idTxtBx_SAOTCC_OTC');
var digits_in_resp_text = apitext_cleaned.match(/\d/g).join("");
var last_6digits = digits_in_resp_text.substr(-6);
var first_or_last = Math.floor(Math.random() * 2) /* 0 or 1 */ == 0;
if (first_or_last) {
last_6digits = digits_in_resp_text.substr(6); // first 6 digits
}
if (last_6digits.length == 6) {
// click next
elein.value = last_6digits;
elein.dispatchEvent(new Event("change"));
document.getElementById('idSubmit_SAOTCC_Continue').click();
}
}
});
}
function is_stay_signed_in_page () {
try {
var col = document.getElementsByClassName('text-title');
for(var i=0;i<col.length;++i) {
if(col[i].innerText.includes("Stay signed in?"))
return true;
}
return false;
} catch {
return false;
}
}
function do_stay_signed_in_page () {
document.getElementById('idSIButton9').click();
}
function is_202311_protect_account_page () {
if(MS_MODE != 202311) return false;
var ele = document.getElementById('heading');
if (ele == null) return false;
return ele.innerText == "Protect your account";
}
function do_202311_protect_account_page () {
document.getElementById('skipMfaRegistrationLink').click();
}
function is_202403_notification_sent_page () {
var ele = document.getElementById('idDiv_SAOTCAS_Title');
if (ele == null) return false;
return ele.innerHTML.includes("Approve sign in request");
}
function do_202403_notification_sent_page () {
var ele = document.getElementById('idRichContext_DisplaySign');
var digits = ele.innerText;
document.getElementById('idDiv_SAOTCAS_Title').innerHTML = "Waiting API"; // Block further detection
GM.xmlHttpRequest({
method: "GET",
url: MSAUTH_APP_API + digits,
onload: function(response) {
var eleout = document.getElementById('idDiv_SAOTCAS_Description');
var apitext = (response.responseText);
if (eleout != null) eleout.innerText = apitext;
}
});
}
function is_202403_auth_fail_page () {
var ele = document.getElementById('idDiv_SAASTO_Title');
if (ele == null) return false;
return ele.innerHTML.includes("We didn't hear from you");
}
function do_202403_auth_fail_page () {
document.getElementById('idA_SAASTO_Resend').click();
}
////////////////////////////////////////////
function main () {
/* Auto generated code. Do not modify by hand.
*
************ RUN this script to generate:
jsfile=Microsoft_auto_login.user.js
echo '
ZWNobyAnaWYoZmFsc2UpOycKZ3JlcCAnXmZ1bmN0aW9uIGlzXycgIiRqc2ZpbGUiIHwgc2VkICdz
L14uKmZ1bmN0aW9uIGlzXy8vZycgfCBzZWQgJ3MvIC4qJC8vZycgfCB3aGlsZSBJRlM9IiIgcmVh
ZCAtciBsaW5lOyBkbwogICAgZWNobyAiZWxzZSBpZihpc18kbGluZSgpKSB7Y29uc29sZS5sb2co
J2lzXyRsaW5lJyk7IGRvXyRsaW5lKCk7fSIKZG9uZQoK
' | base64 -d | source /dev/stdin
************ Auto generated code BEGIN **************/
if(false);
else if(is_pick_an_account_page()) {console.log('is_pick_an_account_page'); do_pick_an_account_page();}
else if(is_signin_email_page()) {console.log('is_signin_email_page'); do_signin_email_page();}
else if(is_signin_email_page_2()) {console.log('is_signin_email_page_2'); do_signin_email_page_2();}
else if(is_request_variants_page()) {console.log('is_request_variants_page'); do_request_variants_page();}
else if(is_pre_request_page()) {console.log('is_pre_request_page'); do_pre_request_page();}
else if(is_choose_a_way_page()) {console.log('is_choose_a_way_page'); do_choose_a_way_page();}
else if(is_sts_auth_options_page()) {console.log('is_sts_auth_options_page'); do_sts_auth_options_page();}
else if(is_sts_pswd_input_page()) {console.log('is_sts_pswd_input_page'); do_sts_pswd_input_page();}
else if(is_sts_2fa_page()) {console.log('is_sts_2fa_page'); do_sts_2fa_page();}
else if(is_202308_2fa_select_page()) {console.log('is_202308_2fa_select_page'); do_202308_2fa_select_page();}
else if(is_202308_2fa_verify_page()) {console.log('is_202308_2fa_verify_page'); do_202308_2fa_verify_page();}
else if(is_202311_2fa_select_page()) {console.log('is_202311_2fa_select_page'); do_202311_2fa_select_page();}
else if(is_202307_2fa_select_page()) {console.log('is_202307_2fa_select_page'); do_202307_2fa_select_page();}
else if(is_202307_2fa_verify_page()) {console.log('is_202307_2fa_verify_page'); do_202307_2fa_verify_page();}
else if(is_stay_signed_in_page()) {console.log('is_stay_signed_in_page'); do_stay_signed_in_page();}
else if(is_202311_protect_account_page()) {console.log('is_202311_protect_account_page'); do_202311_protect_account_page();}
else if(is_202403_notification_sent_page()) {console.log('is_202403_notification_sent_page'); do_202403_notification_sent_page();}
else if(is_202403_auth_fail_page()) {console.log('is_202403_auth_fail_page'); do_202403_auth_fail_page();}
/************ Auto generated code END ****************/
else {
console.log("Unknown page. Doing nothing...");
}
setTimeout(main, 4000);
}
setTimeout(main, 4000);
})();
# recolic daily scripts
Daily scripts written by recolic. Most of them are deprecated and low quality. They are just for future reference as notes.
```
# Expected prefix
git clone <this_repo> "$HOME/sh"
```
## Secrets
From 2024.04.01, this repo goes public, so NO SECRET is allowed in this repo. All secrets in RECOLIC PCs must be stored in config.fish.
```bash
adb shell input tap 300 700
adb shell input tap $x $y
adb shell input swipe $x1 $y1 $x2 $y2
adb shell input swipe $x1 $y1 $x2 $y2 $timeInMilliSecond
adb shell input text 'Hello%sWorld'
adb shell input keyevent 66 #enter
adb shell input keyevent $keyCode
# https://stackoverflow.com/questions/7789826/adb-shell-input-events
adb exec-out screencap -p > screen.png
```
#!/usr/bin/fish
while true
adb shell input touchscreen tap 946 404
sleep 1.2
adb shell input touchscreen tap 1375 444
sleep 0.2
adb shell input touchscreen tap 996 1523
sleep 0.4
continue
adb shell input touchscreen tap 1390 370
sleep 0.2
adb shell input touchscreen tap 728 1100
sleep 0.3
adb shell input touchscreen tap 1390 370
sleep 0.2
adb shell input touchscreen tap 728 930
sleep 0.2
adb shell input touchscreen tap 996 1523
sleep 0.2
end
#!/usr/bin/fish
while true
#adb shell input touchscreen swipe 530 1620 530 300
adb shell input touchscreen swipe 530 1600 530 320 100
end
#!/bin/sh
adb shell pm clear com.baidu.lbs.waimai
adb shell pm clear me.ele
#!/usr/bin/fish
function do_type
#adb shell input text qiangzhizhuxiaozhanghao
adb shell input text $argv[1]
adb shell input keyevent 62
adb shell input keyevent 66
end
while true
echo -n '_'
do_type nimayichangle
sleep 5
echo -n '.'
do_type niquanjiadouyichangle
sleep 5
end
function fuck_wenjuan
adb shell input touchscreen tap 738 1321
sleep 1
adb shell input touchscreen tap 85 2691
end
set i 1
while true
adb shell input touchscreen tap 1000 2350
adb shell input touchscreen tap 1000 2200
adb shell input touchscreen tap 1000 2100
sleep 10
set i (math $i+1)
if test (math $i%16) = 0
fuck_wenjuan
end
end
function enter_multiselect
adb shell input touchscreen swipe 432 1309 432 1309 1000
adb shell input touchscreen tap 867 1131
adb shell input touchscreen swipe 432 1109 432 1109 1000
adb shell input touchscreen tap 867 931
end
function multiselect_delete
adb shell input touchscreen tap 144 2650
sleep 0.5
adb shell input touchscreen tap 710 2414
end
function peek_msgs_3
adb shell input touchscreen tap 750 700
adb shell input touchscreen tap 750 1264
adb shell input touchscreen tap 750 1863
# adb shell input touchscreen tap 750 2280
end
function swipe_down
adb shell input touchscreen swipe 530 1620 530 200 500
sleep 1
end
while true
enter_multiselect
peek_msgs_3
swipe_down
peek_msgs_3
swipe_down
peek_msgs_3
swipe_down
peek_msgs_3
swipe_down
peek_msgs_3
swipe_down
peek_msgs_3
swipe_down
peek_msgs_3
swipe_down
multiselect_delete
sleep 1
end
#!/usr/bin/fish
set i 100000
while true
adb exec-out screencap -p > screen-$i.png
#google pixel 2 xl#adb shell input touchscreen swipe 530 1620 530 200 500
# adb shell input touchscreen swipe 530 1620 530 200 500 # pixel 3 xl.qq
#samsung a9100#adb shell input touchscreen swipe 530 1620 530 600 500
# sshpass -p admin ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 root@10.100.100.172 screencap -p > screen-$i.png
# sshpass -p admin ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 root@10.100.100.172 input touchscreen swipe 530 1620 530 600 500
# pixel 3 xl Alipay
adb shell input touchscreen swipe 530 1620 530 200 400
set i (math $i+1)
end
#!/usr/bin/fish
while true
#adb shell input touchscreen swipe 530 1620 530 300
# sshpass -p admin ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 root@10.100.100.172 input touchscreen swipe 530 300 530 1620 170
adb shell input touchscreen swipe 530 500 530 1620 120
end
function get_data_used
curl -s 'https://www.three.com.hk/ft-prepaid-pro/sim/H3SUB0000151833/getSubProfile' --compressed -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br' -H 'Pragma: no-cache' -H 'platformId: PREPAID_WEB' -H 'platformVersion: 0.31.0' -H 'Authorization: Basic dXNlcjozLmNvbVVYdWF0' -H 'Connection: keep-alive' -H 'Referer: https://www.three.com.hk/prepaid/DIY/en/account/dashboard' -H 'Cookie: AMCV_4CC40C3A53DB08800A490D4D%40AdobeOrg=-637568504%7CMCIDTS%7C19774%7CMCMID%7C49821900624560283942223234132087289909%7CMCOPTOUT-1708445497s%7CNONE%7CvVersion%7C5.1.1; s_cc=true; d70e6e9a58c89e14460d5b0c18e197b1=ddf2b4185050088b5f8125db7ffd30df; TS011f9f53=01378af9ef9471dcac99c29ab5d73223ba3a0e82a820f151b1c8fcc6bdb0c1d9de1905d1b9543492cbf5d820f907e334838b84e7c7; AMCVS_4CC40C3A53DB08800A490D4D%40AdobeOrg=1; SWSID=ZWMxZDgyNTQtZGIyOS00NGVhLTk5YjktNzdlMDQyMDhkMjY5; TS0180ee58=01378af9ef8f85cf0061be47fd6b9f7e62fbbf72a19812495a37b571339d93548944a59e75230e8ec6fe2de2b2f42736bce6bcb818; THREESID=YTAxNDg1ZmEtODgwZS00ZDRlLWI5ZjgtYzUzOGU1OTE5Zjk1' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: same-origin' -H 'Cache-Control: no-cache' | grep -o 'balanceAmount[^,]*,' | grep -v ':0.0,' | cut -d : -f 2 | tr -d ','
end
set used (get_data_used)
echo "STAT: $used MB / 30720 MB"
0. Download http://jp2.comm100.pw:30628/win10pro-22h2-virtio-uefi.qcow2
1. run as root
mkdir -p /srv/swtpm/mytpm
nohup bash -c 'cd /srv/swtpm ; while true; do swtpm socket --tpmstate dir=./mytpm --ctrl type=unixio,path=./mytpm.sock; done' & disown
2. also run as root
qemu-img create -b win10pro-22h2-virtio-uefi.qcow2 -F qcow2 -f qcow2 tmp.qcow2
qemu-system-x86_64 --uuid 35b696a9-0bbc-5a00-b8ef-f1185eff2ae8 -drive file=tmp.qcow2,if=virtio -cpu host --enable-kvm -net nic,model=rtl8139 -m 8G -smp 8 -vnc :13 -bios /usr/share/edk2-ovmf/x64/OVMF.fd -cpu host,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time -chardev socket,id=chrtpm,path=/srv/swtpm/mytpm.sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0
3. Log into VM, check `tpm.msc` and `msinfo32.exe`. you can see TPM is enabled, UEFI boot enabled, but secure boot is "Unsupported".
Note: VM password is "PLACEHOLDER_SECRET"
-------------------------
I need to enable secure boot for this VM. Please tell me how to do that.
#!/bin/fish
for si in (ls /home/recolic/sh/running-config/autostart-gnome/*.sh)
eval "$si & disown"
end
#!/bin/fish
for si in (ls /home/recolic/sh/running-config/autostart-openbox/*.sh)
eval "$si"
end
#!/bin/fish
for si in (ls /home/recolic/sh/running-config/autostart/*.sh)
eval "$si & disown"
end
#!/bin/bash
# Mar 14, 2018, by Recolic Keghart <root@recolic.net>
# Fix mixed http/https content for Alisahhh.github.io
# Required by alisad.sh
git_dir=$1
[[ $git_dir == '' ]] && echo 'Usage: ./alisa_fix.sh <web_root>' && exit 1
function process_a_file () {
fname=$1
tmpfl=`mktemp`
# http to https
cat $fname | sed 's/http:\/\/cube-1252774894.cosgz.myqcloud.com/https:\/\/cube-1252774894.cosgz.myqcloud.com/g' |
sed 's/http:\/\/blog.qzwlecr.com/https:\/\/blog.qzwlecr.com/g' |
sed 's/http:\/\/ww4.sinaimg.cn/https:\/\/ww4.sinaimg.cn/g' |
sed 's/http:\/\/scarletthuang.cn/https:\/\/scarletthuang.cn/g' |
sed 's/http:\/\/www.w3.org/https:\/\/www.w3.org/g' |
sed 's/http:\/\/aplayer.js.org/https:\/\/aplayer.js.org/g' |
sed 's/cube-1252774894.cosgz.myqcloud.com\/music\/lrc\/Dear friends - TRIPLANE.lrc/alisa.asia\/res\/Dear_friends_TRIPLANE.lrc/g' |
sed 's/cube-1252774894.cosgz.myqcloud.com\/music\/lrc\/Butter-Fly (ピアノヴァージョン) - 和田光司.lrc/alisa.asia\/res\/ButterFly.lrc/g' |
sed 's/cube-1252774894.cosgz.myqcloud.com\/music\/lrc\/宵闇花火 - 葉月ゆら.lrc/alisa.asia\/res\/x.lrc/g' > $tmpfl
chmod +r $tmpfl
mv $tmpfl $fname
}
[[ ! -d $git_dir ]] && echo 'Error: web_root not exists' && exit 2
for fl in $(grep 'http://' -r $git_dir | grep ':' | cut -d ':' -f 1 | uniq)
do
echo "Checking $fl..."
process_a_file $fl
done
[[ ! -L $git_dir/res ]] && ln -s /var/www/html/res $git_dir/res && chmod +rx $git_dir/res
#!/bin/bash
# Mar 14, 2018, by Recolic Keghart <root@recolic.net>
# Sync Alisahhh.github.io to ./alisa (->./old_repo_alisa)
# Serving as: https://alisa.asia/
# Dependency: alisa_fix.sh
function git_uptodate () {
git status | grep fatal && exit 1
UPSTREAM=${1:-'@{u}'}
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse "$UPSTREAM")
BASE=$(git merge-base @ "$UPSTREAM")
if [ $LOCAL = $REMOTE ]; then
echo "Up-to-date"
return 0
elif [ $LOCAL = $BASE ]; then
echo "Need to pull"
return 1
elif [ $REMOTE = $BASE ]; then
echo "Need to push"
return 0
else
echo "Diverged"
return 126
fi
}
function do_update_help () {
git clone https://github.com/Alisahhh/Alisahhh.github.io.git new_repo_alisa && ./alisa_fix.sh new_repo_alisa &&
rm -f alisa && ln -s new_repo_alisa alisa &&
rm -rf old_repo_alisa &&
mv new_repo_alisa old_repo_alisa && rm alisa && ln -s old_repo_alisa alisa
}
function do_update () {
if cd alisa 2>/dev/null
then
git_uptodate || do_update_help
cd -
else
do_update_help
fi
}
function _sleep () {
echo "Sleeping $1 s..."
sleep $1
}
[[ $1 == '--force' ]] && do_update_help && _sleep 600
while true; do
do_update
_sleep 600
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment