This repository has been archived by the owner on Jul 19, 2024. It is now read-only.
forked from sebastianrevuelta/bad-python-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IP6.cs
55 lines (40 loc) · 1.52 KB
/
IP6.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Net;
public class IPAddressExample
{
private IPAddress hardcodedIpAddress;
public const string MyIPAddress = "123.168.96.54";
public IPAddressExample()
{
string myIP = "123.168.96.54";
//ok: avoid_ip_address_in_the_code
hardcodedIpAddress = IPAddress.Parse("192.168.0.1");
//ruleid: avoid_ip_address_in_the_code
hardcodedIpAddress = IPAddress.Parse(X, "123.168.96.54");
//ruleid: avoid_ip_address_in_the_code
IP_ADDRESS = "123.168.96.54";
//ruleid: avoid_ip_address_in_the_code
IP_ADDRESS = MY_IP = "123.168.96.54";
//ok: avoid_ip_address_in_the_code
hardcodedIpAddress = IPAddress.Parse("a");
//ok: avoid_ip_address_in_the_code
hardcodedIpAddress = IPAddress.Parse("ab");
//ok: avoid_ip_address_in_the_code
hardcodedIpAddress = IPAddress.Parse("192");
//ok: avoid_ip_address_in_the_code
hardcodedIpAddress = IPAddress.Parse("999.168.0.1");
//ok: avoid_ip_address_in_the_code
hardcodedIpAddress = IPAddress.Parse("127.0.0.1");
//ok: avoid_ip_address_in_the_code
hardcodedIpAddress = IPAddress.Parse("127.0.0.0");
}
public void PrintHardcodedIpAddress()
{
Console.WriteLine("Hardcoded IP Address: " + hardcodedIpAddress.ToString());
}
public static void Main(string[] args)
{
IPAddressExample example = new IPAddressExample();
example.PrintHardcodedIpAddress();
}
}