PROBLEM 1:
how can i remove these external text parts from my ASCII text
in python (i am using pyfiglet ) ? it appears well in VScode
terminal but when i run it from python shell it just appear so
bad like this :
←[33m___________________________________________________←[0m
←[34m ____ _ _ __ __ ______
/ __ \(_)___ ____ _ (_) /_ / / \ \ \ \
/ /_/ / / __ \/ __ `/ / / __/ / / \ \ \ \
/ _, _/ / / / / /_/ / / / /_ /_/ / / / /
/_/ |_/_/_/ /_/\__, / /_/\__/ (_) /_/_/_/
/____/
←[33m←[0m
←[33m___________________________________________________←[0m
←[32m<<< WELCOME TO RING IT APPLICATION >>>
←[0m←[31m
Please enter how many alarms you want to set ?
←[0m
←[95m>>>
here is the header code :
ascii_art = pyfiglet.figlet_format("Ring it ! >>>" , font="slant") + colorama.Fore.YELLOW
ascii_art_colored = colored(ascii_art , "blue")
print(colored("___________________________________________________" , "yellow"))
print("\n\n" +ascii_art_colored + "\n")
print(colored("___________________________________________________" , "yellow")+"\n\n")
print(colored("<<< WELCOME TO RING IT APPLICATION >>>\n" , "green") + colored("\n\nPlease enter how many alarms you want to set ? \n\n" , "red"))
i want to remove these ( ←[33m ←[0m ←[32 )
and it appear like this :
___________________________________________________
____ _ _ __ __ ______
/ __ \(_)___ ____ _ (_) /_ / / \ \ \ \
/ /_/ / / __ \/ __ `/ / / __/ / / \ \ \ \
/ _, _/ / / / / /_/ / / / /_ /_/ / / / /
/_/ |_/_/_/ /_/\__, / /_/\__/ (_) /_/_/_/
/____/
___________________________________________________
<<< WELCOME TO RING IT APPLICATION >>>
Please enter how many alarms you want to set ?
PROBLEM 2 :
also i have an issue with it color ... it just get
cmd theme color not that color i set for it with termcolor2 or
colorama ...
Related
I have bias for module my_dot which is Queue interface. Now, I would like to send this bias as init for accum but without EOT. How to do this?
#gear
def my_dot(din: Queue[Tuple[Fixp[9, 16], Fixp[9, 16]]], bias):
return din \
| queuemap(f=mul) \
| accum(init=din.dtype.data(bias)) \
| g_qround(fract=7) \
| g_saturate(t=Fixp[9, 16])
You did it rightm the only thing you missed is firght number conversion. Instead using din.dtype.data use this:
#gear
def my_dot(din: Queue[Tuple[Fixp[9, 16], Fixp[9, 16]]], bias):
return din \
| queuemap(f=mul) \
| accum(init=bias | Fixp[18, 32]) \
| g_qround(fract=7) \
| g_saturate(t=Fixp[9, 16])
PyGears doesn't have a problem with Queue, framework knows what it should do, so he will drop of EOT and take only "Number".
Here is my python code:
def output(carbs, fat, pro, fiber):
carbs = carbs*4
pro = pro*4
fat = fat*9
fiber = fiber*4
final = carbs + fat + pro - fiber
if(final >= 500):
print("Food: ", "Total Calories: ", final)
elif(final < 100):
print("Food: Salad", "Total Calories: ", final)
elif(final < 500 and final <= 100):
print("Food: Hamburger", "Total Calories: ", final)
def main():
print('''___________ .___ _________ .__ .__ __
\_ _________ ____ __| _/ \_ ___ \_____ | | ____ __ __| | _____ _/ |_
___________
| __)/ _ \ / _ \ / __ | / \ \/\__ \ | | _/ ___\| | | | \__ \\ __/ _ \_
__ \
| \( <_> ( <_> / /_/ | \ \____/ __ \| |_\ \___| | | |__/ __ \| |( <_> |
| \/
\___ / \____/ \____/\____ | \______ (____ |____/\___ |____/|____(____ |__|
\____/|__|
\/ \/ \/ \/ \/ \/ ''')
print("ADD CARBOHYDRATES, FAT, PROTEIN, AND FIBER")
carbs_input = int(input("Carbohydrate content: "))
fat_input = int(input("Fat content: "))
pro_input = int(input("Protein content: "))
fiber_input = int(input("Fiber content: "))
output(carbs, fat, pro, fiber)
main()
Python is telling me that output(carbs, fat, pro, fiber) is not defined. Namely 'carbs'. I think it has to do with the output function.
Any thoughts?
Where are you unclear? Your call to output uses four variables, none of which is defined in that scope. You define variables carbs_input, fat_input, pro_input, fiber_input, but those are the only ones. Try using the variables you defined, instead of those "ghost" variables.
output(carbs_input, fat_input, pro_input, fiber_input)
i tried writing this code but had an error. used windows 10 and python 3.8.5
#usage
#python3 coex.py combo.txt extracted.txt
from sys import argv
import re
script , combo_file , ex_file = argv
cfile = open(combo_file)
xfile = open(ex_file, 'w')
def rexmail(cfile):
rexmail = re.compile(r'[a-zA-Z0-9_.+-]+#[a-zA-Z0-9.-]+:[a-zA-Z0-9._-]+')
cfile = rexmail.findall(cfile.read())
lenofclist = len(cfile)
for i in range(lenofclist):
xfile.write("\n")
xfile.write(str(cfile[i]))
print("[+]*********EXTRACTING DONE***********[+]\n")
print("[+]*********CHECK extracted.txt FILE FOR EMAIL:PASS COMBOS*************[+]\n")
def header():
print('''
made with <3
_______ ___ ___ _________ ________ ________ ________ _________ ________ ________
|\ ___ \ |\ \ / /| |\___ ___\ |\ __ \ |\ __ \ |\ ____\ |\___ ___\ |\ __ \ |\ __ \
\ \ __/| \ \ \/ / / \|___ \ \_| \ \ \|\ \ \ \ \|\ \ \ \ \___| \|___ \ \_| \ \ \|\ \ \ \ \|\ \
\ \ \_|/__ \ \ / / \ \ \ \ \ _ _\ \ \ __ \ \ \ \ \ \ \ \ \ \\\ \ \ \ _ _\
\ \ \_|\ \ / \/ \ \ \ \ \ \\ \| \ \ \ \ \ \ \ \____ \ \ \ \ \ \\\ \ \ \ \\ \|
\ \_______\ / /\ \ \ \__\ \ \__\\ _\ \ \__\ \__\ \ \_______\ \ \__\ \ \_______\ \ \__\\ _\
\|_______| /__/ /\ __\ \|__| \|__|\|__| \|__|\|__| \|_______| \|__| \|_______| \|__|\|__|
|__|/ \|__|
EMAIL:PASS extractor from any txt file .
''')
header()
rexmail(cfile)
Error:
Traceback (most recent call last):
File "C:\Users\BRS\Desktop\minecraft\Combo-Extractor-master\coex.py", line 8, in <module>
script , combo_file , ex_file = argv
ValueError: not enough values to unpack (expected 3, got 1)
I dont really get what's off. please help me by correcting this code. and if possible tell me why this happens
is it a problem with tuples or what pls help with this
argv actually return a list whose first element (i.e. index 0 element) is the location of the python file. To correct this error, use
script, combo_file, ex_file = argv[1:]
Alternatively, you can also use _, script, combo_file, ex_file = argv
Relevant Documentation - https://docs.python.org/3/library/sys.html
(Tested on Windows 10 (64 Bit) Python 3.7.4)
I would like to use wp_scan to scan my wordpress website for new plugins.
I want to have a python script that show me everyday
a list of vulnerable plugins
a list of new plugins.
To write a parser which give me only the vulnerable plugins of the output is not complicate. But how I can write a parser (or in which way) so that I get only a list of new plugins.
Example - (source of the example - I modified it a little bit http://www.blackmoreops.com/2013/10/14/wpscan-and-quick-wordpress-security/).
First day:
___________________________________________________
__ _______ _____
\ \ / / __ \ / ____|
\ \ /\ / /| |__) | (___ ___ __ _ _ __
\ \/ \/ / | ___/ \___ \ / __|/ _` | '_ \
\ /\ / | | ____) | (__| (_| | | | |
\/ \/ |_| |_____/ \___|\__,_|_| |_| v2.1rNA
WordPress Security Scanner by the WPScan Team
Sponsored by the RandomStorm Open Source Initiative
_____________________________________________________
| URL: http://www.blackmoreops.com/
| Started on Sun Oct 13 13:39:25 2013
[31m[!][0m The WordPress 'http://www.blackmoreops.com/readme.html' file exists
[31m[!][0m Full Path Disclosure (FPD) in 'http://www.blackmoreops.com/wp-includes/rss-functions.php'
[32m[+][0m XML-RPC Interface available under http://www.blackmoreops.com/xmlrpc.php
[32m[+][0m WordPress version 3.6.1 identified from meta generator
[32m[+][0m The WordPress theme in use is twentyten v1.6
| Name: twentyten v1.6
| Location: http://www.blackmoreops.com/wp-content/themes/twentyten/
[32m[+][0m Enumerating plugins from passive detection ...
2 plugins found :
| Name: add-to-any v1.2.5
| Location: http://www.blackmoreops.com/wp-content/plugins/add-to-any/
| Directory listing enabled: Yes
| Readme: http://www.blackmoreops.com/wp-content/plugins/add-to-any/README.txt
| Name: captcha v3.8.4
| Location: http://www.blackmoreops.com/wp-content/plugins/captcha/
| Directory listing enabled: Yes
| Readme: http://www.blackmoreops.com/wp-content/plugins/captcha/readme.txt
[32m[+] Finished at Sun Oct 13 13:39:51 2013[0m
[32m[+] Elapsed time: 00:00:26[0m]
on the next day:
___________________________________________________
__ _______ _____
\ \ / / __ \ / ____|
\ \ /\ / /| |__) | (___ ___ __ _ _ __
\ \/ \/ / | ___/ \___ \ / __|/ _` | '_ \
\ /\ / | | ____) | (__| (_| | | | |
\/ \/ |_| |_____/ \___|\__,_|_| |_| v2.1rNA
WordPress Security Scanner by the WPScan Team
Sponsored by the RandomStorm Open Source Initiative
_____________________________________________________
| URL: http://www.blackmoreops.com/
| Started on Sun Oct 13 13:39:25 2013
[31m[!][0m The WordPress 'http://www.blackmoreops.com/readme.html' file exists
[31m[!][0m Full Path Disclosure (FPD) in 'http://www.blackmoreops.com/wp-includes/rss-functions.php'
[32m[+][0m XML-RPC Interface available under http://www.blackmoreops.com/xmlrpc.php
[32m[+][0m WordPress version 3.6.1 identified from meta generator
[32m[+][0m The WordPress theme in use is twentyten v1.6
| Name: twentyten v1.6
| Location: http://www.blackmoreops.com/wp-content/themes/twentyten/
[32m[+][0m Enumerating plugins from passive detection ...
3 plugins found :
| Name: add-to-any v1.2.5
| Location: http://www.blackmoreops.com/wp-content/plugins/add-to-any/
| Directory listing enabled: Yes
| Readme: http://www.blackmoreops.com/wp-content/plugins/add-to-any/README.txt
| Name: captcha v3.8.4
| Location: http://www.blackmoreops.com/wp-content/plugins/captcha/
| Directory listing enabled: Yes
| Readme: http://www.blackmoreops.com/wp-content/plugins/captcha/readme.txt
| Name: google-analyticator v6.4.5
| Location: http://www.blackmoreops.com/wp-content/plugins/google-analyticator/
| Directory listing enabled: Yes
| Readme: http://www.blackmoreops.com/wp-content/plugins/google-analyticator/readme.txt
[32m[+] Finished at Sun Oct 14 13:39:51 2013[0m
[32m[+] Elapsed time: 00:00:26[0m]
Should I separate the string always after a [+] and compare them all
(I don't know how the list of the output is sorted - I think alpahbetic - so I can't get only the last plugins and say this are my new plugins)? Is that efficient? Making the problem simple:
first string:
Hallo
Pet
Me
second string:
Hallo
World
Pet
Me
How I find out what is the new word in a efficient way?
First you split the string in a list and then print every word in the second string given it is not the first string.
str1 = "Hallo Pet Me"
str2 = "Hallo World Pet Me"
split1 = str1.split()
split2 = str2.split()
print [word for word in split2 if word not in split1]
If you want to ignore differences in lower/uppercase:
str1 = "Hallo Pet Me"
str2 = "Hallo World Pet Me"
split1 = str1.lower().split()
split2 = str2.lower().split()
print [word for word in split2 if word not in split1]
Solving your simplified example:
str1 = "Hallo Pet Me"
str2 = "Hallo World Pet Me"
set1 = set(str1.split())
set2 = set(str2.split())
print set2 - set1
You have two sets of strings and you want to obtain strings that are in the second set but not in the first one.
I'm new to Python. I'm trying to make code it so it will print out this ASCII art traffic light, here is the actual ASCII
##
_[]_
[____]
.----' '----.
.===| .==. |===.
\ | /####\ | /
/ | \####/ | \
'===| `""` |==='
.===| .==. |===.
\ | /::::\ | /
/ | \::::/ | \
'===| `""` |==='
.===| .==. |===.
\ | /&&&&\ | /
/ | \&&&&/ | \
'===| `""` |==='
jgs '--.______.--'
And the Code I'm trying to use is this
print ("##"),
print (" _[]_"),
print (".----' '----."),
print (" .===| .==. |===."),
print (" \ | /####\ | /"),
print (" / | \####/ | \\"),
print ("'===| `""` |==='"),
print (" .===| .==. |===."),
print ("\ | /::::\ | /"),
print (" / | \::::/ | \"),
print ("'===| `""` |==='"),
print (".===| .==. |===."),
print (" \ | /&&&&\ | /"),
print (" / | \&&&&/ | \"),
print (" '===| `""` |==='"),
print ("'--.______.--'")
You need to escape the \ characters, double them:
print (" / | \::::/ | \"),
should be:
print(" / | \\::::/ | \\")
You want to get rid of all the commas too.
Note that you can create a multiline string using triple quotes; make it a raw string (using r'') and you don't have to escape anything either:
print(r''' _[]_
[____]
.----' '----.
.===| .==. |===.
\ | /####\ | /
/ | \####/ | \
'===| `""` |==='
.===| .==. |===.
\ | /::::\ | /
/ | \::::/ | \
'===| `""` |==='
.===| .==. |===.
\ | /&&&&\ | /
/ | \&&&&/ | \
'===| `""` |==='
jgs '--.______.--'
''')