Author Topic: [Python] Bind FTP to drive letter  (Read 8453 times)

0 Members and 5 Guests are viewing this topic.

Offline flowjob

  • Knight
  • **
  • Posts: 327
  • Cookies: 46
  • Pastafarian
    • View Profile
[Python] Bind FTP to drive letter
« on: December 17, 2011, 06:09:48 pm »
Hi,
I want to make a little programm to enter a network and edit the files there.
I want to bind ftp to a new drive letter,but i didn't find a way to do this.I only found a way in cmd (net use) but it doesn't work.

Login into the ftp-sever does already work.But does one of you know a way to bind this to a new drive letter?

In advance:
I know there are a lot of programms,wich do this,but it's important to me to make it on my own!

sorry for my bad english.i'm still learning...

Quote
<phil> I'm gonna DDOS the washing machine with clothes packets.
<deviant_sheep> dont use too much soap or youll cause a bubble overflow

Offline ande

  • Owner
  • Titan
  • *
  • Posts: 2664
  • Cookies: 256
    • View Profile
Re: [Python] Bind FTP to drive letter
« Reply #1 on: December 17, 2011, 06:14:21 pm »
Hmm..

You are talking about virtually mapping a directory to a new drive letter. Not quite sure how to do it, but I am sure it is possible. But why not just use the folder you are mapping directly? Except for the cleanness, there is no advantage as far as I can see.

EDIT:
These are probably of interest:
http://www.codejacked.com/quick-tip-assign-a-drive-letter-to-a-folder-windows/
http://www.howtogeek.com/howto/windows-vista/map-a-drive-letter-to-a-folder-the-easy-way-in-windows/
« Last Edit: December 17, 2011, 06:16:17 pm by ande »
if($statement) { unless(!$statement) { // Very sure } }
https://evilzone.org/?hack=true

Offline iAmLuFFy

  • Knight
  • **
  • Posts: 226
  • Cookies: 6
  • i aM MoDiFiEr nOt A cReAtOr
    • View Profile
Re: [Python] Bind FTP to drive letter
« Reply #2 on: December 17, 2011, 06:15:16 pm »
Hi,
I want to make a little programm to enter a network and edit the files there.
I want to bind ftp to a new drive letter,but i didn't find a way to do this.I only found a way in cmd (net use) but it doesn't work.

Login into the ftp-sever does already work.But does one of you know a way to bind this to a new drive letter?

In advance:
I know there are a lot of programms,wich do this,but it's important to me to make it on my own!

sorry for my bad english.i'm still learning...



Well you want to make a program.. can't help in it.
But if you are using windows then you can just map a folder which is on network and accessible as drive on your computer.
iAmLuFFy

Offline flowjob

  • Knight
  • **
  • Posts: 327
  • Cookies: 46
  • Pastafarian
    • View Profile
Re: [Python] Bind FTP to drive letter
« Reply #3 on: December 17, 2011, 06:26:23 pm »
I've already seen the subst command,but how to use it for a directory on a ftp-server?

For example with this server and script:
(very simplified)

Code: (python) [Select]
#Python 2.7
import ftplib
ftp = ftplib.FTP('ftp.example.com')
ftp.login('myusername','mypassword')
ftp.pwd('example')

How to bind the directory 'example' to a drive letter with subst (or something better/else)?
« Last Edit: May 13, 2012, 09:28:02 pm by Area_13 »
Quote
<phil> I'm gonna DDOS the washing machine with clothes packets.
<deviant_sheep> dont use too much soap or youll cause a bubble overflow

Offline ande

  • Owner
  • Titan
  • *
  • Posts: 2664
  • Cookies: 256
    • View Profile
Re: [Python] Bind FTP to drive letter
« Reply #4 on: December 17, 2011, 06:29:20 pm »
Are you asking how to navigate with the FTP protocol or if you can bind a directory to a drive letter with the FTP protocol? Because, you cannot do that with the FTP protocol. You need command access to do so.
if($statement) { unless(!$statement) { // Very sure } }
https://evilzone.org/?hack=true

Offline flowjob

  • Knight
  • **
  • Posts: 327
  • Cookies: 46
  • Pastafarian
    • View Profile
Re: [Python] Bind FTP to drive letter
« Reply #5 on: December 17, 2011, 06:32:51 pm »
I ask how to bind a directory of an ftp server to an drive letter.
I know how to navigate (ftp.cwd('directory'))
Quote
<phil> I'm gonna DDOS the washing machine with clothes packets.
<deviant_sheep> dont use too much soap or youll cause a bubble overflow

Offline ande

  • Owner
  • Titan
  • *
  • Posts: 2664
  • Cookies: 256
    • View Profile
Re: [Python] Bind FTP to drive letter
« Reply #6 on: December 17, 2011, 06:33:30 pm »
I ask how to bind a directory of an ftp server to an drive letter.
I know how to navigate (ftp.cwd('directory'))


Ah, so you can use explorer to nav/open/edit/save etc?

If so, check FTP drive. Google it ;)
« Last Edit: December 17, 2011, 06:34:12 pm by ande »
if($statement) { unless(!$statement) { // Very sure } }
https://evilzone.org/?hack=true

Offline flowjob

  • Knight
  • **
  • Posts: 327
  • Cookies: 46
  • Pastafarian
    • View Profile
Re: [Python] Bind FTP to drive letter
« Reply #7 on: December 17, 2011, 06:36:03 pm »
I never used the explorer.I have always been navigating with ftp.cwd('directory')
But i want to know how to do it with explorer with binding the ftp-server to a new drive letter.


And I want to make it ON MY OWN.
« Last Edit: December 17, 2011, 06:39:42 pm by Area_13 »
Quote
<phil> I'm gonna DDOS the washing machine with clothes packets.
<deviant_sheep> dont use too much soap or youll cause a bubble overflow

Offline ande

  • Owner
  • Titan
  • *
  • Posts: 2664
  • Cookies: 256
    • View Profile
Re: [Python] Bind FTP to drive letter
« Reply #8 on: December 17, 2011, 06:38:30 pm »
I never used the explorer.I have always been navigating with ftp.cwd('directory')
But i want to know how to do it with explorer with binding the ftp-server to a new drive letter.

Yes, just told you. Use FTP Drive(simple software for windows) and map it to a drive. BAM, you can now use your explorer as FTP navigator.
if($statement) { unless(!$statement) { // Very sure } }
https://evilzone.org/?hack=true

Offline flowjob

  • Knight
  • **
  • Posts: 327
  • Cookies: 46
  • Pastafarian
    • View Profile
Re: [Python] Bind FTP to drive letter
« Reply #9 on: December 17, 2011, 06:40:51 pm »
As you can read in my upper post I know that there are a lot of programs for this,but i want to MAKE IT ON MY OWN
« Last Edit: December 17, 2011, 06:41:21 pm by Area_13 »
Quote
<phil> I'm gonna DDOS the washing machine with clothes packets.
<deviant_sheep> dont use too much soap or youll cause a bubble overflow

Offline ande

  • Owner
  • Titan
  • *
  • Posts: 2664
  • Cookies: 256
    • View Profile
Re: [Python] Bind FTP to drive letter
« Reply #10 on: December 17, 2011, 06:47:25 pm »
As you can read in my upper post I know that there are a lot of programs for this,but i want to MAKE IT ON MY OWN

Seams kinda pointless, if there is an existing solution to a problem. Use it. But ohwell. You would need to look into virtual drives then, and python would probably not be your best choice of language. I am thinking C or C++. You probably need to do some kernel hooking maybe. Dunno really, haven't done something like this before.

Nonetheless. What you need to do is make your program and Explorer communicate whenever Explorer accesses the desired drive path, then do whatever Explorer want (open, edit, delete, rename, move) and do the appropriate actions within your program and return the expected result back to Explorer.

My money would be on hooking some directory listing kernel function and then manipulate the results when the desired path is used. There might be some API for this too tho.
« Last Edit: December 17, 2011, 06:47:43 pm by ande »
if($statement) { unless(!$statement) { // Very sure } }
https://evilzone.org/?hack=true

Offline flowjob

  • Knight
  • **
  • Posts: 327
  • Cookies: 46
  • Pastafarian
    • View Profile
Re: [Python] Bind FTP to drive letter
« Reply #11 on: December 17, 2011, 08:29:46 pm »
I had an idea,but it doesn't work:

Code: (python) [Select]
#Python 2.7
import os
import ftplib
ftp = ftplib.FTP('ftp.example.com')
ftp.login('myusername','mypassword')
ftp.pwd('example')
os.system('subst V: ' + ftp.pwd())

Error:
Invalid parameter - /

Because the working directory is '/', and subst needs a drive letter at the beginning of the directory.

Does one know a solution?
Or is it impossible this way (because the server OS is Unix)?
« Last Edit: May 13, 2012, 09:28:32 pm by Area_13 »
Quote
<phil> I'm gonna DDOS the washing machine with clothes packets.
<deviant_sheep> dont use too much soap or youll cause a bubble overflow

Offline ande

  • Owner
  • Titan
  • *
  • Posts: 2664
  • Cookies: 256
    • View Profile
Re: [Python] Bind FTP to drive letter
« Reply #12 on: December 17, 2011, 08:59:26 pm »
I had an idea,but it doesn't work:

#Python 2.7
import os
import ftplib
ftp = ftplib.FTP('ftp.example.com')
ftp.login('myusername','mypassword')
ftp.pwd('example')
os.system('subst V: ' + ftp.pwd())

Error:
Invalid parameter - /

Because the working directory is '/', and subst needs a drive letter at the beginning of the directory.

Does one know a solution?
Or is it impossible this way (because the server OS is Unix)?

It wont work like that, and because there exist FTP servers for all OS's. This is not impossible. However, you cant expect it to work directly like that. You need a translator between the drive and Explorer. Like I said, I don't know if Python is the best suitable language for this.
if($statement) { unless(!$statement) { // Very sure } }
https://evilzone.org/?hack=true

Offline flowjob

  • Knight
  • **
  • Posts: 327
  • Cookies: 46
  • Pastafarian
    • View Profile
Re: [Python] Bind FTP to drive letter
« Reply #13 on: December 17, 2011, 09:15:44 pm »
I'm sure it's not the best,but the only one I can program (except batch)

That there exist FTP Server for all OS isn't a problem,because i make it for my schoolnetwork,and there's UNIX the OS of the server.

What do you mean with I need a translator between the drive and the explorer?
(I'm just a beginner at network-programming)
Quote
<phil> I'm gonna DDOS the washing machine with clothes packets.
<deviant_sheep> dont use too much soap or youll cause a bubble overflow

Offline ande

  • Owner
  • Titan
  • *
  • Posts: 2664
  • Cookies: 256
    • View Profile
Re: [Python] Bind FTP to drive letter
« Reply #14 on: December 17, 2011, 09:30:00 pm »
I'm sure it's not the best,but the only one I can program (except batch)

That there exist FTP Server for all OS isn't a problem,because i make it for my schoolnetwork,and there's UNIX the OS of the server.

What do you mean with I need a translator between the drive and the explorer?
(I'm just a beginner at network-programming)


I mean there have to be someone in the middle between Explorer and the FTP server. As Explorer doesn't know FTP. Like this:
Explorer <-> Your program <-> FTP server

EDIT:
Ohwait, I just found this: http://cybernetnews.com/cybernotes-map-a-ftp-to-a-drive-in-windows/
So Explorer does know FTP. But I am not quite sure how to do this programmatically, but I am sure it is possible by some registery manipulation and so forth.
« Last Edit: December 17, 2011, 09:44:32 pm by ande »
if($statement) { unless(!$statement) { // Very sure } }
https://evilzone.org/?hack=true