Add subnets

This commit is contained in:
Marsh232
2022-09-11 12:10:39 +03:00
parent c2387a14d7
commit a68a313d1c
2 changed files with 37 additions and 20 deletions
+28 -19
View File
@@ -4,7 +4,7 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="56d3644b-12ed-4137-967a-9e3a3c12d93b" name="Changes" comment=""> <list default="true" id="56d3644b-12ed-4137-967a-9e3a3c12d93b" name="Changes" comment="add func subnets">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
</list> </list>
@@ -27,20 +27,20 @@
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent"><![CDATA[{ <component name="PropertiesComponent">{
"keyToString": { &quot;keyToString&quot;: {
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true", &quot;ASKED_SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
"RunOnceActivity.OpenProjectViewOnStart": "true", &quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
"RunOnceActivity.ShowReadmeOnStart": "true", &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
"WebServerToolWindowFactoryState": "false", &quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
"last_opened_file_path": "C:/Users/truno/Documents/GitHub/Telegram-IP-CALC", &quot;last_opened_file_path&quot;: &quot;C:/Users/truno/Documents/GitHub/Telegram-IP-CALC&quot;,
"node.js.detected.package.eslint": "true", &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
"node.js.detected.package.tslint": "true", &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
"node.js.selected.package.eslint": "(autodetect)", &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
"node.js.selected.package.tslint": "(autodetect)", &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
"settings.editor.selected.configurable": "proofread" &quot;settings.editor.selected.configurable&quot;: &quot;proofread&quot;
} }
}]]></component> }</component>
<component name="RunManager" selected="Python.main"> <component name="RunManager" selected="Python.main">
<configuration name="main (2)" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true"> <configuration name="main (2)" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
@@ -103,7 +103,8 @@
<workItem from="1662485900255" duration="690000" /> <workItem from="1662485900255" duration="690000" />
<workItem from="1662496666820" duration="3601000" /> <workItem from="1662496666820" duration="3601000" />
<workItem from="1662542574124" duration="3363000" /> <workItem from="1662542574124" duration="3363000" />
<workItem from="1662648763510" duration="5768000" /> <workItem from="1662648763510" duration="5935000" />
<workItem from="1662886058001" duration="1294000" />
</task> </task>
<task id="LOCAL-00001" summary="Add basic output"> <task id="LOCAL-00001" summary="Add basic output">
<created>1662545492088</created> <created>1662545492088</created>
@@ -119,7 +120,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1662545590298</updated> <updated>1662545590298</updated>
</task> </task>
<option name="localTasksCounter" value="3" /> <task id="LOCAL-00003" summary="add func subnets">
<created>1662661462393</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1662661462393</updated>
</task>
<option name="localTasksCounter" value="4" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@@ -139,20 +147,21 @@
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="Add basic output" /> <MESSAGE value="Add basic output" />
<MESSAGE value="hz" /> <MESSAGE value="hz" />
<option name="LAST_COMMIT_MESSAGE" value="hz" /> <MESSAGE value="add func subnets" />
<option name="LAST_COMMIT_MESSAGE" value="add func subnets" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>
<breakpoints> <breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line"> <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/main.py</url> <url>file://$PROJECT_DIR$/main.py</url>
<line>37</line> <line>45</line>
<option name="timeStamp" value="1" /> <option name="timeStamp" value="1" />
</line-breakpoint> </line-breakpoint>
</breakpoints> </breakpoints>
</breakpoint-manager> </breakpoint-manager>
</component> </component>
<component name="com.intellij.coverage.CoverageDataManagerImpl"> <component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/Telegram_IP_CALC$main.coverage" NAME="main Coverage Results" MODIFIED="1662659792918" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" /> <SUITE FILE_PATH="coverage/Telegram_IP_CALC$main.coverage" NAME="main Coverage Results" MODIFIED="1662887260465" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
</component> </component>
</project> </project>
+9 -1
View File
@@ -26,8 +26,16 @@ def subnets(ip, prefix):
subnet1 = ipaddress.ip_network(str(list_subnet[1]), strict=False) subnet1 = ipaddress.ip_network(str(list_subnet[1]), strict=False)
print('\nМаска:', subnet1.netmask, '=', prefix) print('\nМаска:', subnet1.netmask, '=', prefix)
print()
#for i in for i in list_subnet:
subnet2 = ipaddress.ip_network(i, strict=False)
print('Network:', subnet2)
print('Broadcast:', subnet2.broadcast_address)
print('HostMin:', subnet2[1])
print('HostMax:', subnet2[-2])
print('Hosts:', len(list((subnet2.hosts()))))
print()
if __name__ == '__main__': if __name__ == '__main__':