mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-10-19 22:17:29 +02:00
26 lines
876 B
Python
26 lines
876 B
Python
"""Local SMB2 fixture for TEST_SMB=1 flutter test test/network_storage_service_test.dart.
|
|
|
|
Requires impacket in a temporary Python environment. Listens only on loopback,
|
|
uses port 1445, and exposes only generated test data in a temporary directory.
|
|
"""
|
|
|
|
from pathlib import Path
|
|
from tempfile import TemporaryDirectory
|
|
|
|
from impacket.ntlm import compute_lmhash, compute_nthash
|
|
from impacket.smbserver import SimpleSMBServer
|
|
|
|
|
|
def main():
|
|
with TemporaryDirectory(prefix="spotiflac-smb-test-") as root:
|
|
(Path(root) / "A B.wav").write_bytes(bytes(range(256)))
|
|
server = SimpleSMBServer(listenAddress="127.0.0.1", listenPort=1445)
|
|
server.addShare("MUSIC", root)
|
|
server.setSMB2Support(True)
|
|
server.addCredential("test", 0, compute_lmhash("secret"), compute_nthash("secret"))
|
|
server.start()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|