Monday, January 2, 2017

So I'll explain..SCADA systems, or multicast configurations on CISCO routers, have not more by default ways to go over and over routing packets...but I want more than that solution..what I want is to READ all vrf ip PID's...but more important of course than reaching to PLC's circuits, is to have total control on the OBJECT_TYPE...meaning the logger keys.

eAPI Python script to look at ARP entries per VRF

I needed to see all the different ARP entries in each VRF, so I wrote up this little script to do just that. The ‘show vrf’ command in eAPI has not yet been converted to JSON, so I had to do some text parsing to get the VRF names, then use those names to grab the ARP entries. On line 4 you’ll see that I use the ‘text’ option for the output of the JSON reply. That allows me to run a command that hasn’t been converted yet and get the raw text output:
response = switch.runCmds( 1, ["show vrf"], "text" )
The output looks like this:
"output": "   Vrf         RD            Protocols       State         Interfaces \n----------- ------------- --------------- ---------------- ---------- \n   test        100:100       ipv4            no routing               \n   test2       101:101       ipv4            no routing               \n   test3       102:102       ipv4            no routing               \n\n"
Or in a more familiar format:
   Vrf         RD            Protocols       State         Interfaces
----------- ------------- --------------- ---------------- ----------
   test        100:100       ipv4            no routing
   test2       101:101       ipv4            no routing
   test3       102:102       ipv4            no routing
Then I take the output and use splitlines() to take each line (separated by newline) and insert them into a list:
lines = response[0]['output'].splitlines()
Now I iterate through each entry of the ‘show ip vrf’ output and issue a ‘show ip arp vrf’ with the VRF name. I use the range() function, starting at the 3rd line (since the first two are just header lines), and go through the end of the list. Then I use the split() method to split each line on whitespace, taking the first entry which corresponds to the VRF name. Finally, I can use that VRF name in my command.
for i in range(2, len(lines) - 1):
  vrfname = lines[i].split()[0]
  command = "show ip arp vrf " + vrfname
Here’s the script in its entirety:
from jsonrpclib import Server
switch = Server( "https://admin:admin@leaf1/command-api" )
response = switch.runCmds( 1, ["show vrf"], "text" )
lines = response[0]['output'].splitlines()
for line in lines:
print line
for i in range(2, len(lines) - 1):
vrfname = lines[i].split()[0]
command = "show ip arp vrf " + vrfname
response = switch.runCmds( 1, [command] )
print vrfname
print response[0]

Thursday, December 22, 2016


How to Designate an IP Address as Permitted Sender


If you have your own domain handling email, then chances are you may run into email issues.  It is extremely important that you properly designate your IP Address as a permitted sender.
First, let’s test to see if your domain is a permitted sender.
Log into your domain’s email account, brant@example.com let’s say.  Send an email to another email account that you have access to.  Just to name a few… gmail, Yahoo!, or Hotmail.
The important part is for you to view headers of this email, often referred to as “Show Full Headers”.
You will see something that looks like this, but note the SPF softfail error:
—- Original message —–
X-Received: by 10.224.25.8 with SMTP id x8mr31561868qab.77.1382465370255;
Tue, 22 Oct 2013 11:09:30 -0700 (PDT)
Return-Path: brant@example.com
Received: from my3.example.com (my3.example.com. [64.131.70.223])
by mx.google.com with ESMTPS id k5si10380639qen.50.2013.10.22.11.09.30
for send@domain.com
(version=TLSv1 cipher=RC4-SHA bits=128/128);
Tue, 22 Oct 2013 11:09:30 -0700 (PDT)
Received-SPF: softfail (google.com: domain of transitioning  brant@example.com does not designate 64.131.70.223 as permitted sender) client-ip=64.131.70.223;
Authentication-Results: mx.google.com;
spf=softfail (google.com: domain of transitioning brant@example.com does not designate 64.131.70.223 as permitted sender) smtp.mail=brant@example.com

If you see Received-SPF: pass in the header then you have nothing to worry about.  However, as you can see from above, I have a softfail issue.  You may also see some with “fail”.
The fix is actually pretty easy.  Login to your registrar where you registered the domain.  What we need to do is create a new TXT record and add that specific IP (64.131.70.223) as a permitted sender.
The record will look something like this:
TXT    example.com    “v=spf1 ip4:64.131.70.223 ~all”
Add this entry to your registrar and wait for the record to update across the web.  You can test your TXT / SPF entry with this handy tool.
A few things to note here:
  • Make sure you use the quotation marks around the whole thing.  (Do not just copy and paste from here because WordPress sometimes uses a different characters for quotes.)
  • The last part ~all designates a softfail for any non permitted senders.  Softfail basically means that you haven’t finalized your email settings yet.  These emails have a chance of getting through, even though they fail.
  • Once you send another test email and confirm that you PASS, change the ~all to -all.  This means that any emails not from your designated senders should fail.
Sounds great, but what happens when you use another email provider, like mailjet to send email on your behalf?
Your TXT entry will then look like this:
TXT    example.com    “v=spf1 ip4:64.131.70.223 include:spf.mailjet.com -all”
Setting up email can be a bit frustrating, so hopefully this helps speed things along.
Still confused?  You may also find Eric’s article on setting up SPF records useful.

Hack mil elsa GET REQUEST special character defesa.pt

  https://example.com/api/data?query=hello%20world https://example.com/api/data?search=rock%26roll%3Dawesome%23fun https://intranet.marinha....