Sponsored Content
Top Forums Shell Programming and Scripting Python FTP login and relogin with other data in one wash? Post 302854337 by lowmaster on Tuesday 17th of September 2013 07:51:54 AM
Old 09-17-2013
Python FTP login and relogin with other data in one wash?

I have a short part of the script like this, which scrans ftp ips from a list and login with the data specified.

Code:
login1
pssword1

is it possible to try sevral login data without starting the script again with modified login data?

somehow like:
if (login1 pw1 or login2 pw2 or login3 pw3)
{
print "unsafe"
}

Code:
                    try:
                        ftp = ftplib.FTP(ip_add)
                        ftp.login('login1', 'password1') 
                    except ftplib.all_errors:
                        print 'OK: %s' % (ip_add)
                    else:
                        print 'Unsafe PW: %s' % (ip_add)
                        write = open('Ftp.txt', "a+")
                        write.write(ip_add + '\n')
                        write.close()  
                        ftp.quit()

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using Python to grab data from a website

Hello Everyone, I'm trying to write a python script that will go to the following website and grab all the data on the page. The page refreshes regularly and the number of flights is different. Untitled Document What I wanted to do was grab all the data (except for top three row containing... (5 Replies)
Discussion started by: jl487
5 Replies

2. Shell Programming and Scripting

Python/Perl script for auto login

I am loooking for a python/perl script which can login to gmail or any mail accounts and open a browser with the logged in page. I am trying this in a windows environment. I tried many docs available over internet an nothing seems to be working. (4 Replies)
Discussion started by: Tuxidow
4 Replies

3. Solaris

Relogin

hello, how to re-login with other user without shutting down the system in solaris 10. And how to change the shell from root user to normal user. for example: if we type "su -" it logs to super user "#" and how to get back to "$".. (1 Reply)
Discussion started by: newbobby
1 Replies

4. Solaris

FTP log only shows FTP LOGIN FROM entry?

OS: Solaris 9 Configuration /etc/syslog.conf daemon.debug /etc/inetd.conf ftp stream tcp6 nowait root /usr/sbin/in.ftpd in.ftpd -A -l -d Found the ftp.log only generate those entries from other servers/hosts. Can we trace on all ftp entries either from/to the server? ... (6 Replies)
Discussion started by: KhawHL
6 Replies

5. UNIX for Dummies Questions & Answers

Ftp login commands

Hello, I am using ftp on command line. The problem is getting bumped off after 15 minutes of no activity.. I have two options: quit ftp and use the command history of my shell, or stay in ftp and use 'open' command, where I can use the command history saved in the ftp program. Either option... (1 Reply)
Discussion started by: Allasso
1 Replies

6. Shell Programming and Scripting

Execute python file, FTP output to another server

Greetings all, We are implementing a new tool called URLwatch which is a python utility. Here are the requirements. 1) Run every 10 seconds 2) Execute the python script 3) Output file gets generated, FTP it to a differernt server I gave no idea how to do this and management needs a demo... (3 Replies)
Discussion started by: jeffs42885
3 Replies

7. UNIX for Dummies Questions & Answers

Maximum number of data in Python

Hi all, I would like to save my output data in two columns. I tried print(x,y) but have two problems: 1. There are ~10000 values for each x and y, but the intermediates are omitted; 2. I'd like to list data in two columns instead of two arrays (BTW, it's fine as I can format it using other... (3 Replies)
Discussion started by: sxiong
3 Replies

8. Shell Programming and Scripting

Python non iterable data

I have a data of this format which I am trying to parse in my python script: { "mydict": } Is there a way to get corresponding value of DATA3 of the set containing DATA1 as "UK" using python? I tried dictionary iteration but its failing. (2 Replies)
Discussion started by: ctrld
2 Replies

9. High Performance Computing

Python code runs on login node but not on cluster

I work for one of my professors and we are trying to run SU2 in parallel on a cluster owned by the university that uses slurm for its workload manager. The problem we are running into is that when we ssh into the cluster and run the command: parallel_computation.py -f SU2.cfg on an assigned... (0 Replies)
Discussion started by: devinmgibson
0 Replies
NETRC(5)						      BSD File Formats Manual							  NETRC(5)

NAME
netrc -- user configuration for ftp SYNOPSIS
~/.netrc DESCRIPTION
This file contains configuration and autologin information for the File Transfer Protocol client ftp(1). The .netrc file contains login and initialization information used by the auto-login process. It resides in the user's home directory. The following tokens are recognized; they may be separated by spaces, tabs, or new-lines: machine name Identify a remote machine name. The auto-login process searches the .netrc file for a machine token that matches the remote machine specified on the ftp command line or as an open command argument. Once a match is made, the subsequent .netrc tokens are processed, stopping when the end of file is reached or another machine or a default token is encountered. default This is the same as machine name except that default matches any name. There can be only one default token, and it must be after all machine tokens. This is normally used as: default login anonymous password user@site thereby giving the user automatic anonymous ftp login to machines not specified in .netrc. This can be overridden by using the -n flag to disable auto-login. login name Identify a user on the remote machine. If this token is present, the auto-login process will initiate a login using the specified name. password string Supply a password. If this token is present, the auto-login process will supply the specified string if the remote server requires a password as part of the login process. Note that if this token is present in the .netrc file for any user other than anonymous, ftp will abort the auto-login process if the .netrc is readable by anyone besides the user. account string Supply an additional account password. If this token is present, the auto-login process will supply the specified string if the remote server requires an additional account password, or the auto-login process will initiate an ACCT command if it does not. macdef name Define a macro. This token functions like the ftp macdef command functions. A macro is defined with the specified name; its con- tents begin with the next .netrc line and continue until a null line (consecutive new-line characters) is encountered. If a macro named init is defined, it is automatically executed as the last step in the auto-login process. SEE ALSO
ftp(1), ftpd(8) Linux NetKit (0.17) September 23, 1997 Linux NetKit (0.17)
All times are GMT -4. The time now is 06:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy