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

47
.idea/workspace.xml generated
View File

@@ -4,7 +4,7 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<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$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
</list>
@@ -27,20 +27,20 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"WebServerToolWindowFactoryState": "false",
"last_opened_file_path": "C:/Users/truno/Documents/GitHub/Telegram-IP-CALC",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"settings.editor.selected.configurable": "proofread"
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;ASKED_SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
&quot;last_opened_file_path&quot;: &quot;C:/Users/truno/Documents/GitHub/Telegram-IP-CALC&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;proofread&quot;
}
}]]></component>
}</component>
<component name="RunManager" selected="Python.main">
<configuration name="main (2)" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<option name="INTERPRETER_OPTIONS" value="" />
@@ -103,7 +103,8 @@
<workItem from="1662485900255" duration="690000" />
<workItem from="1662496666820" duration="3601000" />
<workItem from="1662542574124" duration="3363000" />
<workItem from="1662648763510" duration="5768000" />
<workItem from="1662648763510" duration="5935000" />
<workItem from="1662886058001" duration="1294000" />
</task>
<task id="LOCAL-00001" summary="Add basic output">
<created>1662545492088</created>
@@ -119,7 +120,14 @@
<option name="project" value="LOCAL" />
<updated>1662545590298</updated>
</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 />
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -139,20 +147,21 @@
<component name="VcsManagerConfiguration">
<MESSAGE value="Add basic output" />
<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 name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/main.py</url>
<line>37</line>
<line>45</line>
<option name="timeStamp" value="1" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
<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>
</project>

10
main.py
View File

@@ -26,8 +26,16 @@ def subnets(ip, prefix):
subnet1 = ipaddress.ip_network(str(list_subnet[1]), strict=False)
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__':