Batch file or script to telnet to multiple hosts, log initial output then close and test next host
I have a large list of IP addresses from a database that I need to sanitize and determine which type of host (it'll be one of 2 device types) each IP address relates to.
Is there a way of using a batch file and/or Putty to telnet to (but not necessarily log in to) each host, check the initial message from the host, log it to a file and then disconnect and test the next one and so on?
batch batch-file putty telnet
add a comment |
I have a large list of IP addresses from a database that I need to sanitize and determine which type of host (it'll be one of 2 device types) each IP address relates to.
Is there a way of using a batch file and/or Putty to telnet to (but not necessarily log in to) each host, check the initial message from the host, log it to a file and then disconnect and test the next one and so on?
batch batch-file putty telnet
What operating system? What shell? Note: Welcome to Super User. Unfortunately, we are not a code-writing service. Instead of simply asking for code to perform a particular task, please show us what you've tried so far (including any code you currently have) and where you're stuck so that we can help you with your specific problem. Questions that only ask for code are too broad and are likely to be put on hold or closed. Please read How do I ask a good question?.
– DavidPostill♦
Jun 23 '15 at 12:19
Apologies if you've misinterpreted the question. I'm not sure where I asked anyone for code? I want to know if it's possible before I start exploring how. I'm asking about capabilities of batch files, not requesting code.
– Faldinio
Jun 23 '15 at 13:04
I you do know how-to achieve your task for a particular (hard-coded) IP address, then yes, it's possible using modified loop:FOR /F "delims=" %%G IN (list_of_IP_addresses.txt) DO ECHO %%G
– JosefZ
Jun 23 '15 at 22:24
add a comment |
I have a large list of IP addresses from a database that I need to sanitize and determine which type of host (it'll be one of 2 device types) each IP address relates to.
Is there a way of using a batch file and/or Putty to telnet to (but not necessarily log in to) each host, check the initial message from the host, log it to a file and then disconnect and test the next one and so on?
batch batch-file putty telnet
I have a large list of IP addresses from a database that I need to sanitize and determine which type of host (it'll be one of 2 device types) each IP address relates to.
Is there a way of using a batch file and/or Putty to telnet to (but not necessarily log in to) each host, check the initial message from the host, log it to a file and then disconnect and test the next one and so on?
batch batch-file putty telnet
batch batch-file putty telnet
asked Jun 23 '15 at 12:14
FaldinioFaldinio
612
612
What operating system? What shell? Note: Welcome to Super User. Unfortunately, we are not a code-writing service. Instead of simply asking for code to perform a particular task, please show us what you've tried so far (including any code you currently have) and where you're stuck so that we can help you with your specific problem. Questions that only ask for code are too broad and are likely to be put on hold or closed. Please read How do I ask a good question?.
– DavidPostill♦
Jun 23 '15 at 12:19
Apologies if you've misinterpreted the question. I'm not sure where I asked anyone for code? I want to know if it's possible before I start exploring how. I'm asking about capabilities of batch files, not requesting code.
– Faldinio
Jun 23 '15 at 13:04
I you do know how-to achieve your task for a particular (hard-coded) IP address, then yes, it's possible using modified loop:FOR /F "delims=" %%G IN (list_of_IP_addresses.txt) DO ECHO %%G
– JosefZ
Jun 23 '15 at 22:24
add a comment |
What operating system? What shell? Note: Welcome to Super User. Unfortunately, we are not a code-writing service. Instead of simply asking for code to perform a particular task, please show us what you've tried so far (including any code you currently have) and where you're stuck so that we can help you with your specific problem. Questions that only ask for code are too broad and are likely to be put on hold or closed. Please read How do I ask a good question?.
– DavidPostill♦
Jun 23 '15 at 12:19
Apologies if you've misinterpreted the question. I'm not sure where I asked anyone for code? I want to know if it's possible before I start exploring how. I'm asking about capabilities of batch files, not requesting code.
– Faldinio
Jun 23 '15 at 13:04
I you do know how-to achieve your task for a particular (hard-coded) IP address, then yes, it's possible using modified loop:FOR /F "delims=" %%G IN (list_of_IP_addresses.txt) DO ECHO %%G
– JosefZ
Jun 23 '15 at 22:24
What operating system? What shell? Note: Welcome to Super User. Unfortunately, we are not a code-writing service. Instead of simply asking for code to perform a particular task, please show us what you've tried so far (including any code you currently have) and where you're stuck so that we can help you with your specific problem. Questions that only ask for code are too broad and are likely to be put on hold or closed. Please read How do I ask a good question?.
– DavidPostill♦
Jun 23 '15 at 12:19
What operating system? What shell? Note: Welcome to Super User. Unfortunately, we are not a code-writing service. Instead of simply asking for code to perform a particular task, please show us what you've tried so far (including any code you currently have) and where you're stuck so that we can help you with your specific problem. Questions that only ask for code are too broad and are likely to be put on hold or closed. Please read How do I ask a good question?.
– DavidPostill♦
Jun 23 '15 at 12:19
Apologies if you've misinterpreted the question. I'm not sure where I asked anyone for code? I want to know if it's possible before I start exploring how. I'm asking about capabilities of batch files, not requesting code.
– Faldinio
Jun 23 '15 at 13:04
Apologies if you've misinterpreted the question. I'm not sure where I asked anyone for code? I want to know if it's possible before I start exploring how. I'm asking about capabilities of batch files, not requesting code.
– Faldinio
Jun 23 '15 at 13:04
I you do know how-to achieve your task for a particular (hard-coded) IP address, then yes, it's possible using modified loop:
FOR /F "delims=" %%G IN (list_of_IP_addresses.txt) DO ECHO %%G
– JosefZ
Jun 23 '15 at 22:24
I you do know how-to achieve your task for a particular (hard-coded) IP address, then yes, it's possible using modified loop:
FOR /F "delims=" %%G IN (list_of_IP_addresses.txt) DO ECHO %%G
– JosefZ
Jun 23 '15 at 22:24
add a comment |
1 Answer
1
active
oldest
votes
You can look in to using expect. It should suit your needs. There are a few questions/posts on here about it.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f931473%2fbatch-file-or-script-to-telnet-to-multiple-hosts-log-initial-output-then-close%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can look in to using expect. It should suit your needs. There are a few questions/posts on here about it.
add a comment |
You can look in to using expect. It should suit your needs. There are a few questions/posts on here about it.
add a comment |
You can look in to using expect. It should suit your needs. There are a few questions/posts on here about it.
You can look in to using expect. It should suit your needs. There are a few questions/posts on here about it.
edited Mar 20 '17 at 10:17
Community♦
1
1
answered Nov 21 '16 at 15:29
daveluptdavelupt
179110
179110
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f931473%2fbatch-file-or-script-to-telnet-to-multiple-hosts-log-initial-output-then-close%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What operating system? What shell? Note: Welcome to Super User. Unfortunately, we are not a code-writing service. Instead of simply asking for code to perform a particular task, please show us what you've tried so far (including any code you currently have) and where you're stuck so that we can help you with your specific problem. Questions that only ask for code are too broad and are likely to be put on hold or closed. Please read How do I ask a good question?.
– DavidPostill♦
Jun 23 '15 at 12:19
Apologies if you've misinterpreted the question. I'm not sure where I asked anyone for code? I want to know if it's possible before I start exploring how. I'm asking about capabilities of batch files, not requesting code.
– Faldinio
Jun 23 '15 at 13:04
I you do know how-to achieve your task for a particular (hard-coded) IP address, then yes, it's possible using modified loop:
FOR /F "delims=" %%G IN (list_of_IP_addresses.txt) DO ECHO %%G
– JosefZ
Jun 23 '15 at 22:24