If you be able to set USB debugging to enabled, then it is easier. But we assume that you can't even to log in to your device to do so. Then following instruction to enable USB debugging as a prerequisite (not necessarily as there are some magic software out there) that is from someone on stack exchange and I just copy that here could be helpful.
Enable USB debugging through recovery mode and ADB sideload
Asked 2 years, 3 months ago
Modified 2 years, 3 months ago
Viewed 4k times
3
This is a follow up question to this one. Basically, I intend to somehow use this command to remove the lock screen:
adb sideload customROM.zip
But, the customROM.zip should be something like described here to enable USB debugging. The problem is, those steps are incomplete:
Steps to Enable USB Debugging Using Recovery Mode
Unzip the stock ROM.
Within the extracted folder, you will find the system.img well extract it too using Ext4 Unpacker
Also, extract the Update-SuperSU.v1.65.zip file.
Now open the folder where you have extracted the system.img files
Grab any .apk file from this folder and change the extension from .apk to .zip
And Copy the RSA Certificated to the Update-SuperSU.v1.65 folder (delete previous files if exist)
Also, copy the build.prop to the system folder located within Update-SuperSU.v1.65 folder
Locate the update-script file within this folder and edit it using Notepad++
You need to update the build.prop file after adding the following line at the bottom persist.service.adb.enable=1
Next step is updating SQLite Database
Which can be done by adding the following code to the update-script file sqlite3 /data/data/com.android.providers.settings/databases/settings.db "UPDATE global SET value=1 WHERE name='adb_enabled'"
Cheers! You have Enabled USB Debugging Now you can install your custom or stock ROM using ADB – USB Debugging
Although the above steps seem incomplete, they look convincing that there might be a way to modify a stock ROM to enable USB debugging by:
adb sideload modified-stock-ROM-which-just-enables-USB-debugging-and-does-nothing-else.zip
Is there any better explanation than those steps?
https://android.stackexchange.com/questions/230999/enable-usb-debugging-through-recovery-mode-and-adb-sideload
https://www.isrgrajan.com/how-to-enable-usb-debugging-in-android-using-recovery-mode.html