I have been working on a great script to remotely gather server info and store it in a .txt that can be imported to .xls
I have been reading the hostnames that are in the /.shh/known_hosts file so I don't have to mess with passing a password - via ssh (not easy to do , by the way, but posibble) anyway...
I have been stripping the known_hosts file of the following , trying to get a clean hosts.txt file to use as my CONFIRMED list of servers with exchanged keys.
I have removed the follow:
- ssh key
- extra charaters and extended hostnames
(e.g. myserver vs myserver_backup) So I would remove the "_backup"
- duplicates
So I am looking to manage the text. move all hostnames to the first column and ip's to the 2nd comma separated spot. And move all single column enties to the bottom hostname first then ip's, but that doesn't really matter, just need to know how to manipulate the text, I know your going to say... reg expressions, but I want the easiest way or at least a way I can repeat and reuse for separate tasks.(something I understand)
Hi
I have only ever used awk and sed for basic requirements up until now.
I have had to break a log down for multiple purposes.
Using awk, sed and a date script. I am left with this:
(message id, time of msg attempt, message id, domain name, time of msg completion)
... (4 Replies)
Hi there,
I have some text files in unix format that processed by a program in windows, and when I open them with less or vi in linux, a warn for opening binary file is prompted, and as shown in vi, between every two characters there was inserted a "^@". How can I fix this. Plus, there are over... (2 Replies)
I'm in need of help for a project that I'm working on. I believe Perl would be the best way of handling the string manipulation, however, I've barely used perl, and I'm used to BASH scripting. Another note is, this project is in a Windows environment, so I can use Perl, but I do not have shell... (1 Reply)
Hello unix.com people!
How can I modify a text in format:
A:B:C
A:B:C
A:B:C
into
C/A/B
C/A/B
C/A/B
Note: Text is line by line and "C", "B", "A" fields are different each row.
Thanks in advance. (7 Replies)
Hello again unix.com
How can I extract from a large file in format:
steve@aol.com steve hawkins Location of this member is bla bla bla
sun@hotmail.com Sun Ying This member is using browser bla bla bla
to another text in format:
steve@aol.com steve hawkins
sun@hotmail.com sun ying
... (5 Replies)
Hello Unix.com,
I have a text in format:
john
sara
lee
How can I make it:
john:john
john:john1
john:john12
john:john123
sara:sara
sara:sara12
sara:sara123 and so on (2 Replies)
Hello unix.com users,
I have a ip file (line-by-line). How can I delete the ips that keep repeating by mark XXX.XXX.XXX.* ... I want to erase only the lines that keep repeating more than 2 times.
Example:
1.2.3.1
1.2.3.2
1.2.3.3
I want to erase all ips blocks that are repeating by C... (1 Reply)
Hello unix.com
I'm having trouble with a text file.
It looks like this:
Alvaro Costa Daldit Kaur Sings Brian G Heward
Desmond Ogilvie John Der William Gherasim
Lance Mackey Donald Kopplin Robert Mckinlay
Jahir Hussain Mohamed Jack Benaim Abraham Weiss
I want... (7 Replies)
i want to generate a list line-by-line of normal characters
using letters . for example :
dnds
gnos
mgod
pets
jnfp
etc...
i want to use all letters with all the posibilities
is there a script that can do this ? (3 Replies)
Discussion started by: suppliernr1
3 Replies
LEARN ABOUT DEBIAN
sshfp
SSHFP(1) Internet / DNS SSHFP(1)NAME
sshfp - Generate SSHFP DNS records from knownhosts files or ssh-keyscan
SYNTAX
sshfp [-k <knownhosts_file>] [-d] [-a] | [<host1> [host2 ...]] sshfp -s [-p <port>] [-d] <-a> [-n <nameserver>] <domain1> [domain2] |
<host1> [host2 ...] >
DESCRIPTION
sshfp generates RFC4255 SSHFP DNS records based on the public keys stored in a known_hosts file, which implies the user has previously
trusted this key, or public keys can be obtained by using ssh-keyscan (1). Using ssh-keyscan (1) implies a secure path to connect to the
hosts being scanned. It also implies a trust in the DNS to obtain the IP address of the hostname to be scanned. If the nameserver of the
domain allows zone tranfers (AXFR), an entire domain can be processed for all its A records.
OPTIONS -s / --scan <hostname1> [hostname2 ...]
Scan hosts or domain for public SSH keys using ssh-keyscan
-k / --knownhosts <knownhosts_file> <hostname1> [hostname2 ...]
Obtain public SSH keys from a known_hosts file. Defaults to using ~/.ssh/known_hosts
-a / --all
Scan all hosts in the known_hosts file when used with -k. When used with -s, it will attempt an zone transfer (AXFR) to obtain all A
records in the domain specified.
-d / --trailing-dot
Add a trailing dot to the hostname in the SSHFP records. It is not possible to determine whether a known_hosts or dns query is for a
FQDN (eg www.xelerance.com) or not (eg www) or not (unless -d domainname -a is used, in which case a trailing dot is always appended).
Non-FQDN get their domainname appended through /etc/resolv.conf These non-FQDN will happen when using a non-FQDN (eg sshfp -k www) or
known_hosts entries obtained by running ssh www.sub where .domain.com is implied. When -d is used, all hostnames not ending with a dot,
that at least contain two parts in their hostname (eg www.sub but not www get a trailing dot. Note that the output of sshfp can also
just be manually editted for trailing dots.
-o / --output <filename>
Write to filename instead of stdout
-p / --port <portnumber>
Use portnumber for scanning. Note that portnumbers do NOT appear in SSHFP records.
-h / --help
Output help information and exit.
-v / --version
Output version information and exit.
-q / --quiet
Output less miscellany to stderr
FILES
~/.ssh/known_hosts
REQUIREMENTS
sshfp requires python-dns (http://www.pythondns.org)
Fedora: yum install python-dns
Debian: apt-get install python-dnspython
BUGS
if a domain contains non-working glue A records, then ssh-keyscan aborts instead of skipping the single broken entry.
This program can look up hashed hostnames in a known_hosts file if a recent-enough ssh-keygen is present
EXAMPLES
typical usage:
sshfp (implies -k -a)
sshfp -a -d (implies -k)
sshfp -k bofh.xelerance.com (from known_hosts)
sshfp -s bofh.xelerance.com (from a scan to the host)
sshfp -k ~paul/.ssh/known_hosts bofh.xelerance.com www.openswan.org -o /tmp/mysshfp.txt
sshfp -a -d -d xelerance.com -n ns0.xelerance.net >> /var/named/primary/xelerance.com
SEE ALSO ssh-keyscan(1)ssh(1) and RFC-4255
http://www.xelerance.com/software/sshfp/
http://lists.xelerance.com/mailman/listinfo/sshfp/
AUTHORS
Paul Wouters <paul@xelerance.com>, Jacob Appelbaum <jacob@appelbaum.net>, James Brown <jbrown@yelp.com>
COPYRIGHT
Copyright 2006-2010 Xelerance Corporation
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See
<http://www.fsf.org/copyleft/gpl.txt>.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License (file COPYING in the distribution) for more
details.
Paul Wouters April 12, 2011 SSHFP(1)