177 lines
8.8 KiB
VB.net
177 lines
8.8 KiB
VB.net
Imports System.IO
|
||
Imports System.Net
|
||
Imports System.Net.Mail
|
||
Imports System.Security.Cryptography
|
||
Imports System.Text
|
||
|
||
Public Class drive8
|
||
Dim tcon = Drive.tcon
|
||
Private Sub drive8_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||
Dim lines1a() As String = File.ReadAllLines(théme)
|
||
If lines1a(0) = 2 Then
|
||
BackColor = Color.FromArgb(64, 64, 64)
|
||
ForeColor = Color.White
|
||
Label1.BackColor = Color.FromArgb(64, 64, 64)
|
||
Button1.BackColor = Color.FromArgb(64, 64, 64)
|
||
ComboBox1.BackColor = Color.FromArgb(64, 64, 64)
|
||
Label1.ForeColor = Color.White
|
||
Button1.ForeColor = Color.White
|
||
ComboBox1.ForeColor = Color.White
|
||
ElseIf lines1a(0) = 3 Then
|
||
BackColor = Form1.BackColor
|
||
ForeColor = Form1.ForeColor
|
||
Button1.BackColor = BackColor
|
||
ComboBox1.BackColor = BackColor
|
||
Button1.ForeColor = ForeColor
|
||
ComboBox1.ForeColor = ForeColor
|
||
End If
|
||
|
||
Try
|
||
Dim fwr As FtpWebRequest
|
||
fwr = FtpWebRequest.Create(ipserver & "/" & "Utilisateur" & "/")
|
||
fwr.Credentials = New NetworkCredential("yoannsafe", passftp)
|
||
fwr.Method = WebRequestMethods.Ftp.ListDirectory
|
||
Dim sr As New StreamReader(fwr.GetResponse().GetResponseStream())
|
||
|
||
Dim str As String = sr.ReadLine()
|
||
While Not str Is Nothing
|
||
|
||
Directory.CreateDirectory(cozip & str)
|
||
ComboBox1.Items.Add(str)
|
||
ComboBox1.Items.Remove("utilisateur.txt")
|
||
ComboBox1.Items.Remove("index.php")
|
||
str = sr.ReadLine()
|
||
End While
|
||
|
||
sr.Close()
|
||
For Each fichier As String In IO.Directory.GetDirectories(cozip)
|
||
Dim info As New IO.FileInfo(fichier)
|
||
Directory.Delete(cozip & info.Name)
|
||
Next
|
||
Catch ex As Exception
|
||
End Try
|
||
ComboBox1.Items.Remove(tcon)
|
||
ComboBox1.SelectedIndex = 0
|
||
End Sub
|
||
|
||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||
ListBox1.Items.Clear()
|
||
Dim fwr2 As FtpWebRequest
|
||
fwr2 = FtpWebRequest.Create(ipserver & "/Utilisateur/" & ComboBox1.SelectedItem & "/")
|
||
fwr2.Credentials = New NetworkCredential("yoannsafe", passftp)
|
||
fwr2.Method = WebRequestMethods.Ftp.ListDirectory
|
||
Dim sr2 As New StreamReader(fwr2.GetResponse().GetResponseStream())
|
||
|
||
Dim str2 As String = sr2.ReadLine()
|
||
While Not str2 Is Nothing
|
||
|
||
|
||
If str2.Contains("driveattfile") = True Then
|
||
ListBox1.Items.Add(str2)
|
||
End If
|
||
str2 = sr2.ReadLine()
|
||
|
||
End While
|
||
|
||
sr2.Close()
|
||
|
||
If ListBox1.Items.Count = 1 Then
|
||
upfile()
|
||
Else
|
||
Dim MaRequete As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(ipserver & "/Utilisateur/" & ComboBox1.SelectedItem & "/driveattfile/"), System.Net.FtpWebRequest)
|
||
Dim ftpStream As Stream = Nothing
|
||
|
||
MaRequete.Credentials = New System.Net.NetworkCredential("yoannsafe", passftp)
|
||
MaRequete.Method = System.Net.WebRequestMethods.Ftp.MakeDirectory
|
||
|
||
Dim response As FtpWebResponse = CType(MaRequete.GetResponse, FtpWebResponse)
|
||
ftpStream = response.GetResponseStream
|
||
ftpStream.Close()
|
||
response.Close()
|
||
upfile()
|
||
End If
|
||
End Sub
|
||
Sub upfile()
|
||
If Drive.TextBox1.Text = "" Then
|
||
Dim sw1 As New StreamWriter(dosparamètres & "\(" & tcon.ToString & ") " & Drive.ListBox1.SelectedItem.ToString & ".txt")
|
||
sw1.WriteLine(ipsite & "utilisateur/" & tcon & "/dirve/" & Drive.ListBox1.SelectedItem)
|
||
sw1.Close()
|
||
My.Computer.Network.UploadFile(dosparamètres & "\(" & tcon.ToString & ") " & Drive.ListBox1.SelectedItem.ToString & ".txt", ipserver & "/utilisateur/" & ComboBox1.SelectedItem & "/driveattfile/(" & tcon.ToString & ") " & Drive.ListBox1.SelectedItem.ToString & ".txt")
|
||
File.Delete(dosparamètres & "\(" & tcon.ToString & ") " & Drive.ListBox1.SelectedItem.ToString & ".txt")
|
||
My.Computer.Network.DownloadFile(ipsite & "/utilisateur/" & ComboBox1.SelectedItem & "/mail.txt", dosparamètres & "\mailtemp.txt")
|
||
|
||
Dim lines() As String = File.ReadAllLines(dosparamètres & "\mailtemp.txt")
|
||
File.Delete(dosparamètres & "\mailtemp.txt")
|
||
Dim Resultatbytes() As Byte = Convert.FromBase64String(lines(0))
|
||
Dim keyBytes() As Byte = Encoding.UTF8.GetBytes("Jj@msms7")
|
||
Dim Crypto As New DESCryptoServiceProvider()
|
||
Crypto.Key = keyBytes
|
||
Crypto.IV = keyBytes
|
||
Dim Icrypto As ICryptoTransform = Crypto.CreateDecryptor()
|
||
Dim donné() As Byte = Icrypto.TransformFinalBlock(Resultatbytes, 0, Resultatbytes.Length)
|
||
Dim mailcrypt = Encoding.UTF8.GetString(donné)
|
||
Dim MyMailMessage As New MailMessage()
|
||
Dim SMTPServer As New SmtpClient("mail48.lwspanel.com")
|
||
Dim mail = mailcrypt
|
||
Dim message = "L’utilisateur: " & Drive.tcon & " vous a partager le fichier: " & Drive.ListBox1.SelectedItem & vbNewLine & vbNewLine & "Ceci est un message automatique merci de ne pas répondre."
|
||
|
||
MyMailMessage.From = New MailAddress("noreply@lecteur-media.fr")
|
||
MyMailMessage.To.Add(mail)
|
||
MyMailMessage.Subject = ("Partage de fichier Lecteur média de: " & Drive.tcon)
|
||
MyMailMessage.Body = (message)
|
||
|
||
SMTPServer.Port = ("587") 'Port
|
||
SMTPServer.Credentials = New System.Net.NetworkCredential("noreply@lecteur-media.fr", "pC1*zzU9-qtZjdT")
|
||
SMTPServer.EnableSsl = True
|
||
|
||
|
||
SMTPServer.Send(MyMailMessage) 'Envoi
|
||
|
||
MsgBox("Le ficher: " & Drive.ListBox1.SelectedItem & " a bien êtê partager avec " & ComboBox1.SelectedItem, MsgBoxStyle.Information)
|
||
Close()
|
||
Else
|
||
Dim sw1 As New StreamWriter(dosparamètres & "\(" & tcon.ToString & ") " & Drive.ListBox1.SelectedItem.ToString & ".txt")
|
||
sw1.WriteLine(ipsite & "utilisateur/" & tcon & "/dirve/" & Drive.TextBox1.Text & "/" & Drive.ListBox1.SelectedItem)
|
||
sw1.Close()
|
||
My.Computer.Network.UploadFile(dosparamètres & "\(" & tcon.ToString & ") " & Drive.ListBox1.SelectedItem.ToString & ".txt", ipserver & "/utilisateur/" & ComboBox1.SelectedItem & "/driveattfile/(" & tcon.ToString & ") " & Drive.ListBox1.SelectedItem.ToString & ".txt")
|
||
File.Delete(dosparamètres & "\(" & tcon.ToString & ") " & Drive.ListBox1.SelectedItem.ToString & ".txt")
|
||
My.Computer.Network.DownloadFile(ipsite & "/utilisateur/" & ComboBox1.SelectedItem & "/mail.txt", dosparamètres & "\mailtemp.txt")
|
||
|
||
Dim lines() As String = File.ReadAllLines(dosparamètres & "\mailtemp.txt")
|
||
File.Delete(dosparamètres & "\mailtemp.txt")
|
||
Dim Resultatbytes() As Byte = Convert.FromBase64String(lines(0))
|
||
Dim keyBytes() As Byte = Encoding.UTF8.GetBytes("Jj@msms7")
|
||
Dim Crypto As New DESCryptoServiceProvider()
|
||
Crypto.Key = keyBytes
|
||
Crypto.IV = keyBytes
|
||
Dim Icrypto As ICryptoTransform = Crypto.CreateDecryptor()
|
||
Dim donné() As Byte = Icrypto.TransformFinalBlock(Resultatbytes, 0, Resultatbytes.Length)
|
||
Dim mailcrypt = Encoding.UTF8.GetString(donné)
|
||
Dim MyMailMessage As New MailMessage()
|
||
Dim SMTPServer As New SmtpClient("mail48.lwspanel.com")
|
||
Dim mail = mailcrypt
|
||
Dim message = "L’utilisateur: " & Drive.tcon & " vous a partager le fichier: " & Drive.ListBox1.SelectedItem & vbNewLine & vbNewLine & "Ceci est un message automatique merci de ne pas répondre."
|
||
|
||
MyMailMessage.From = New MailAddress("noreply@lecteur-media.fr")
|
||
MyMailMessage.To.Add(mail)
|
||
MyMailMessage.Subject = ("Partage de fichier Lecteur média de: " & Drive.tcon)
|
||
MyMailMessage.Body = (message)
|
||
|
||
SMTPServer.Port = ("587") 'Port
|
||
SMTPServer.Credentials = New System.Net.NetworkCredential("noreply@lecteur-media.fr", "pC1*zzU9-qtZjdT")
|
||
SMTPServer.EnableSsl = True
|
||
|
||
|
||
SMTPServer.Send(MyMailMessage) 'Envoi
|
||
|
||
MsgBox("Le ficher: " & Drive.ListBox1.SelectedItem & " a bien êtê partager avec " & ComboBox1.SelectedItem, MsgBoxStyle.Information)
|
||
Close()
|
||
End If
|
||
|
||
End Sub
|
||
|
||
Private Sub ComboBox1_SelectedValueChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedValueChanged
|
||
Me.Text = "Partager avec " & ComboBox1.SelectedItem
|
||
Button1.Text = "Partager avec " & ComboBox1.SelectedItem
|
||
End Sub
|
||
End Class |