我正在 VB.NET (Visual Studio 2013) 编写一个应用程序,作为最后一步,它有两个将文件夹(里面有几个文件)复制到 iPhone 中的某个目录中。
iPhone 已越狱,因此可以访问各种目录,并且还应该通过 USB 连接到 PC。这可能吗?
我可以告诉您如何以编程方式执行此操作:
首先,您需要通过 USB 建立 SSH 隧道。您可以通过以编程方式执行 this zip 中的 itunnel_mux.exe 来做到这一点。(您必须先提取所有内容。)像这样使用它:
itunnel_mux.exe --tunnel -iport 22 -lport 2222
然后,您可以使用 SCP(我推荐这个库)从 [email protected]:2222(密码 alpine)复制文件。
这是一些示例伪代码:
'Extract the exe and dll file from that zip
extract_files()
'I'm making a new variable containing the port number.
Dim port As string = "2222"
'I made up this function. Lets pretend it executes Batch code in the current directory (like a bat file)
execbat("itunnel_mux.exe --tunnel -iport 22 -lport " + port)
Using scp As New Rebex.Net.Scp
' connect to a server
scp.Connect(hostname)
' authenticate (change alpine if you changed your root passwd)
scp.Login("root", "alpine")
' Here, you can use "scp" to upload and download files
scp.PutFile("C:\Users\KevinKZ\Desktop\fileToUpload.jpg", "/var/mobile/Documents/fileToUpload.jpg")
scp.GetFile("/var/mobile/Library/SMS/sms.db", "C:\Users\KevinKZ\Desktop\SMS_Backups\2-1-14.db")
scp.Disconnect()
End Using
这个解决方案远非优雅。它还需要 OpenSSH(我认为)。使用 libimobiledevice 可能会更好。
如果可以从 Windows 访问该目录,则可以。