"Internet Protocol Version 4 (TCP/IPv4)" in AutoHotKey - autohotkey

This autohotkey program will get me only part of the way.
I need to select "Internet Protocol Version 4 (TCP/IPv4)" and click properties on the "Wireless Network Connection Properties"
Run ncpa.cpl
WinWaitActive Network Connections
SendInput {Tab 4}{Right}!{Enter} ; change {Tab 4} to suit the position of your specific connection in the Connections list
WinWaitActive Wireless Network Connection Properties ; change the title if necessary, for example, if you're on LAN.
SendInput {Down 4}!r

I assume you want to change the IP address of the device?
Changing the ip and gateway:
Run, PowerShell New-NetIPAddress –InterfaceAlias “Wireless Network Connection” –IPv4Address “192.168.0.1” –PrefixLength 24 -DefaultGateway 192.168.0.254
Changing the primary and secondary dns server:
Run, PowerShell Set-DnsClientServerAddress -InterfaceAlias “Wireless Network Connection” -ServerAddresses 192.168.0.1, 192.168.0.2

Related

TcpTestSucceeded: False cannot connect to specific port

I am trying to connect to open up port 89 on my Windows machine so others can access it, but I'm having trouble doing so. I added a rule to Firewall to allow access to port 89, but it still seems like it's not working. Any advice on how to resolve or even how to debug?
PS D:\> Test-NetConnection devbox -p 89
WARNING: TCP connect to (fe80::188d:3b90:868b:c3f6%5 : 89) failed WARNING: TCP connect to (2001:4898:3:25:7975:d61e:f88e:bfe2 : 89) failed WARNING: TCP connect to (2001:4898:3:25:188d:3b90:868b:c3f6 : 89) failed WARNING: TCP connect to (fe80::4c9e:1380:c530:b43a%42 : 89) failed WARNING: TCP connect to (fe80::6d77:dd66:a5b1:902c%26 : 89) failed WARNING: TCP connect to (fe80::69d3:4282:2917:485d%18 : 89) failed WARNING: TCP connect to (fe80::c9a:5dbc:5823:fdd9%13 : 89) failed WARNING: TCP connect to (10.123.77.38 : 89) failed WARNING: TCP connect to (172.24.96.1 : 89) failed WARNING: TCP connect to (172.24.48.1 : 89) failed WARNING: TCP connect to (172.21.128.1 : 89) failed WARNING: TCP connect to (2001:0:d5b:9458:c9a:5dbc:5823:fdd9 : 89) failed ComputerName : devbox RemoteAddress : fe80::188d:3b90:868b:c3f6%5 RemotePort : 89
InterfaceAlias : vEthernet (New Virtual Switch)
SourceAddress : 2001:4898:3:25:188d:3b90:868b:c3f6
PingSucceeded : True
PingReplyDetails (RTT) : 0 ms
TcpTestSucceeded : False
Be sure that you or your friend exactly do this:
Navigate to Control Panel, System and Security and Windows Firewall.
Select Advanced settings and highlight Inbound Rules in the left pane.
Right click Inbound Rules and select New Rule.
Add the port you need to open and click Next.
Add the protocol (TCP or UDP) and the port number into the next window and click Next.
Select Allow the connection in the next window and hit Next.
Select the network type as you see fit and click Next.
Name the rule something meaningful and click Finish.
That's all you have to do to open a firewall port in Windows 10
Many devices have open ports to send error reports to a server. But
the things is those devices are their to send and then recieve
acknowledgement to the sent packet. So what you need is a device to
recieve and then send to. To overcome this problem, you need to become
that server which the device request/send to and recieve the service
from it. You can send a .bat file to a friend/ victim laptop which cab
change its dns and gateway address to your server which you will be
running ,hence Becoming the middle man.(just an example)
Client tries to connect to IPv6 address: TCP connect to (fe80::188d:3b90:868b:c3f6%5 : 89) failed.
Maybe your server is listening only IPv4.
Also the problem may come from trying to connect to an IPv6 address instead of the IPv4 address that you are listening to. Instead, you can try entering the IPv4 address, 10.3.10.200, as the "ComputerName" to restrict the test to IPv4.
Notify me if this works for you.

Find correct internet protocol for given IP and PORT

I'm adding firewall rules for specific IP and PORT in Windows 10. But I'm getting errors the:
The protocol is invalid.
Address that I need to add:
13.79.172.43/8883,443
3.250.210.0/23
3.250.243.64/26
3.251.56.0/24
3.251.62.128/25
34.245.205.0/27
18.130.91.148/30
Example of what I'm using:
New-NetFirewallRule -DisplayName "Block-Wireless-In-01" -Name "Block-Wireless-In-01" -Direction Inbound -InterfaceType Wireless -Action Block -RemoteAddress 13.79.172.43 -LocalPort 8883,443 - Protocol TCP
Options I have in Windows firewall settings for defining protocol are:
HOPOPT
ICMPv4
IGMP
TCP
UDP
IPv6
IPv6-Route
IPv6-Frag
GRE
ICMPv6
IPv6-NoNxt
IPv6-Opts
VRRP
PGM
L2TP
How to find the right protocol for each address and what to choose in firewall settings?

Search and test connection to AWS RDS using Windows Power Shell

I am trying to install and configure TFS Server on Windows 2012 AWS EC2 instance. I will like to configure an RDS SQL Server as backend but I am facing some issues with the connection so I am testing the ports and the connection using this command:
Test-NetConnection -Port 1433 -ComputerName tfsserver.sqlserver.region.rds.amazonaws.com -InformationLevel Detailed
And the command result is:
ComputerName : tfsserver.sqlserver.region.rds.amazonaws.com
RemoteAddress : sql_server_address
RemotePort : 1433
AllNameResolutionResults : sql_server_address
MatchingIPsecRules :
NetworkIsolationContext : Internet
InterfaceAlias : Ethernet
SourceAddress : tfs_server_address
NetRoute (NextHop) : gateway_hop_address
PingSucceeded : False
PingReplyDetails (RTT) : 0 ms
TcpTestSucceeded : False
Note: I changed originals IP address and RDS endpoint name
My issue here is:
The ping command is not allowed in my security group so how do I know if the connection is open because:
TcpTestSucceeded : False
Is that result related with the ping command or is the 1433 port closed? I will like to know if the connection is open.
That is a result of the tcp port not being accessible. Either as it's not open, its not allowed somewhere along the path (local firewall, route or RDS security group)
If you specify the -Port parameter then it's a TCP test not an ICMP echo (ping) https://technet.microsoft.com/en-us/library/dn372891.aspx

tcl socket server for port range

I'm currently starting a Tcl socket server like this:
socket -server Server 0
This lets the operating system pick an available port to start listening on. The question is that I don't want it to pick any port between 1025 and 64k, instead want to know if I can specify a range of ports? Something like this:
socket -server Server 40000-41000
And then the operating system would pick an available port between 40000 and 41000 for the server to listen on. Is there a way to do this? I can't find it in the Tcl API, but is there some nice API call way to do it rather than iterating through the port range until finding an available port?
The OS itself doesn't provide an API capable of doing that, and Tcl doesn't wrap one up for you as it is actually a pretty rare requirement. Conventionally, servers either listen on specific ports (so clients can know exactly what service to ask for; e.g., 21 for FTP, 22 for SSH, 25 for SMTP, 80 for HTTP, 161 for SNMP, 443 for HTTPS, 993 for secure IMAP) or the clients have some other way of being told what to ask for and genuinely any port will do (0 is the special “pick a card, any card” address). You can ask a Tcl server socket for what port it is actually using fconfigure:
set portNumber [lindex [fconfigure $socket -sockname] 2]
But to get a server socket on a port in a specific range? No API for that. We have to cook something ourselves:
for {set port 40000} {$port <= 41000} {incr port} {
if {![catch {
set sock [socket -server $yourHandler $port]
}]} then {
break
}
}
# If we failed...
if {![info exist sock]} {
error "No ports free in range 40k-41k"
}
This works because failing to bind the port will make the socket creation fail (neatly, catchably) and you can then try to bind the next port. It will take a while to scan over the port range, but it will work.
It's probably neater to wrap this up in a procedure. And Tcl 8.6's try construct will make the code a little less obscure:
proc portInRange {from to handler} {
for {set p $from} {$p <= $to} {incr p} {
try {
return [socket -server $handler $p]
} on error {} continue
}
error "No ports free in range $from-$to"
}
No, there's no API for that.
Generally servers listen on a specific port so that the clients can find the server. So such an API is not particularly useful.
Best to just write it yourself.

New NetQosPolicy

I am attempting to set up a new quality of service for VoIP on windows 8.1. As I do not have Pro the "gpedit.msc" is unavailable so I am utilizing Windows Power Shell to create a Quality of Service Policy with the New-NetQosPolicy parameter. Unfortunately the traffic is still populating as the default O through WireShark. I have tried disabling the entire firewall and simply allowing the softphone through all 3 levels of the firewall to no avail. My policies are below, while they are both successfully set they are not working.
NOTE: This is a physical machine, not virtual.
New-NetQosPolicy -Name "Line of Business VOICE" -AppPathNameMatchCondition "%ProgramFiles(x86)%\VoIPphone.exe" -DSCPAction 46 -IPProtocolMatchCondition UDP -IPSrcPortEndMatchCondition 20000 -IPSrcPortStartMatchCondition 10000 -PolicyStore "MY-PC" -UserMatchCondition "Me"
New-NetQosPolicy -Name "Line of Business SIP" -AppPathNameMatchCondition "%ProgramFiles(x86)%\VoIPphone.exe" -DSCPAction 24 -IPProtocolMatchCondition UDP -IPSrcPortMatchCondition 5060 -PolicyStore "MY-PC" -UserMatchCondition "Me"
Maybe change out the %ProgramFiles(x86)% for ${env:ProgramFiles(x86)}?