I'm on windows 8 and using cygwin, g++. I wrote a member function of my Connection class which is maintaining a connection and provides some operation to do with it. One of them is below:
const char* Connection::recieve_all_data()
{
using namespace utils;
if(socket_ == INVALID_SOCKET)
{
throw std::invalid_argument("Socket was not initialized\n");
}
std::string result = std::string();
char *buf = new char[BUFFER_SIZE];
while(true)
{
int iResult = recv(socket_, buf, utils::BUFFER_SIZE, 0);
if(iResult == BUFFER_SIZE)
{
result.append(buf);
std::cout << buf << std::endl << std::endl; //1, LOOK AT THIS LINE
}
else if (iResult < BUFFER_SIZE)
{
char *final_buffer = new char[iResult + 1];
strncpy(final_buffer, buf, iResult);
final_buffer[iResult] = '\0';
result.append(final_buffer);
break;
}
else if(iResult == WSAENOTCONN)
{
throw std::runtime_error("Socket was not connected");
}
}
return result.c_str();
}
I tried to test that function to receive some data from google.com. And the thing is if line //1 is not commented I receive the fulle respose asa follows:
HTTP/1.0 400 Bad Request
Content-Type: text/html; charset=UTF-8
Content-Length: 1419
Date: Wed, 25 Mar 2015 12:12:51 GMT
Server: GFE/2.0
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 400 (Bad Request)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}#media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/errors/logo_sm_2.png) no-repeat}#media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/errors/logo_sm_2_hr.png) 0}}#media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:55px;width:150px}
</style>
<a href=//www.google.com/><span id=logo aria-label=Google></span></a>
<p><b>400.</b> <ins>That’s an error.</ins>
<p>Your client has issued a malformed or illegal request. <ins>That’s all we know.</ins>
but if I comment line //1 the recieved response is not full:
HTTP/1.0 400 Bad Request
Content-Type: text/html; charset=UTF-8
Content-Length: 1419
Date: Wed, 25 Mar 2015 12:12:07 GMT
Server: GFE/2.0
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 400 (Bad Request)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}#media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/errors/logo_sm_2.png) no-repeat}#media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/errors/logo_sm_2_hr.png) 0}}#media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:55px;width:150px}
</style>
<a href=
What's worng? I have really no idea about that behavior. How can the line //1 ever affect the result? It's just an output. Maybe it's a cygwin problem?
Related
To keep it short, i setup CloudFront to "fix" my problem that when i went onto my AWS website it showed my Social header but nothing else: AWS Website
but when i tried to use CloudFront: CloudFront Website it still looks the same... when i test my code in VSC it shows me the whole website like its supposed to What its Supposed to look like
I set it up with the tutorial from Amazon, its redirected to the right website yet it still doesnt show... its HTTPS so it isn't that... any suggestions?
<html>
<title>Future Company Design</title>
<head><link rel="shortcut icon" type="image/x-icon" href="file:///C:/Users/LNGM/OneDrive%20-%20System%20Industrie%20Electronic%20GmbH/Bilder/favicon.ico" /></head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {margin:0;height:2000px;}
body,h1 {font-family: "Raleway", sans-serif}
body, html {height: 100%}
.bgimg {
background-image: url('file:///C:/Users/LNGM/Downloads/website.jpg');
min-height: 100%;
background-position: center;
background-size: cover;
}
.icon-bar {
position: absolute;
right: -720;
top: -50;
}
.icon-bar a {
display:flex;
text-align: left;
padding: 16px;
transition: all 0.3s ease;
color: white;
font-size: 20px;
}
.icon-bar a:hover {
background-color: rgb(196, 44, 44);
}
.Twitch {
background: #6441a5;
color: white;
}
.twitter {
background: #55ACEE;
color: white;
}
.instagram {
background: #125688;
color: white;
}
.linkedin {
background: #007bb5;
color: white;
}
</style>
<body>
<script>
var countDownDate = new Date("Dec 23, 2022 08:00:00").getTime();
var x = setInterval(function() {
var now = new Date().getTime();
var distance = countDownDate - now;
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
document.getElementById("demo").innerHTML = days + "d " + hours + "h "
+ minutes + "m " + seconds + "s ";
if (distance < 0) {
clearInterval(x);
document.getElementById("demo").innerHTML = "Website going Live in only a Couple of Minutes";
}
}, 1000);
</script>
<div class="bgimg w3-display-container w3-animate-opacity w3-text-white">
<div class="w3-display-topleft w3-padding-large w3-xlarge">
<img src="file:///C:/Users/LNGM/Downloads/rsz_logo_small.png">
</div>
<div class="w3-display-middle">
<h1 class="w3-jumbo w3-animate-top">Work in Progress</h1>
<hr class="w3-border-grey" style="margin:auto;width:40%">
<p id="demo" class="w3-large w3-center"></p>
<div class="icon-bar">
<i class="fa fa-twitter"></i>
<i class="fa fa-instagram"></i>
<i class="fa fa-linkedin"></i>
<i class="fa fa-Twitch"></i>
</body>
</html>
Would propose to use relative path when referencing other static assets in your website. This will prevent broken linkages when you deploy in S3. EG. file:///C:/Users/LNGM/Downloads/website.jpg don't exists in S3, its a reference to a specific path in your PC
The legend labels are not in the DOM when using time series data.
I have around 1500 data points. Here is reduced it to 3 because it seems like the amount of data points is not the cause of the issue.
Is this a bug or did I misconfigure something?
I also tried using a separate div for the legend (like described here but it seems to have no effect.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AmCharts</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="http://cdn.date-fns.org/v2.0.0-alpha0/date_fns.min.js"></script>
<script src="https://cdn.amcharts.com/lib/4/core.js"></script>
<script src="https://cdn.amcharts.com/lib/4/charts.js"></script>
<script src="https://cdn.amcharts.com/lib/4/themes/animated.js"></script>
<style>
html, body {
font-size: 16px;
}
#chartdiv,
#legenddiv {
width: 100%;
height: 500px;
border: 1px dotted #c99;
margin: 1em 0;
}
#legenddiv {
height: 150px;
}
</style>
</head>
<body>
<div id="chartdiv"></div>
Legend:
<div id="legenddiv"></div>
<script src="./main.js"></script>
</body>
</html>
am4core.ready(function () {
am4core.useTheme(am4themes_animated); // theming
var chart = am4core.create("chartdiv", am4charts.XYChart);
chart.data = [{
"date": 1574861644000,
"value": 13505
},
{
"date": 1574861645000,
"value": 13505
},
{
"date": 1574861645000,
"value": 13492
}];
// Create axes
var dateAxis = chart.xAxes.push(new am4charts.DateAxis());
dateAxis.baseInterval = { timeUnit: "second", count: 1 };
var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
// Create series
var series = chart.series.push(new am4charts.LineSeries());
series.dataFields.valueY = "value";
series.dataFields.dateX = "date";
series.tooltipText = "{value}";
series.tooltip.pointerOrientation = "vertical";
chart.cursor = new am4charts.XYCursor();
chart.cursor.snapToSeries = series;
chart.cursor.xAxis = dateAxis;
// create a legend for the sensors
chart.legend = new am4charts.Legend();
let legendContainer = am4core.create("legenddiv", am4core.Container);
legendContainer.width = am4core.percent(100);
legendContainer.height = am4core.percent(100);
chart.legend.parent = legendContainer;
}); // end am4core.ready()
By default the legend will look at the series' name property to use as the legend label as documented here. Adding this to your series will fix the problem, e.g. series.name = "Series #1"
I am attempting a hacking exercise in a network security course. However, I am stuck with understanding how to use Burp Suite.
This is the RAW data:
GET /ekohshahrabohpha/cgi-bin/users.php HTTP/1.1
Host: 134.219.148.11:61166
Connection: close
Accept: */*
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/601.4.4 (KHTML, like Gecko) Version/9.0.3 Safari/601.4.4
Accept-Language: en-us
Referer: http://134.219.148.11:61166/ekohshahrabohpha/
Accept-Encoding: gzip, deflate
This is the Header - how do you edit the header to include some bash command injection to gain access to the following URL?
GET /ekohshahrabohpha/ HTTP/1.1
Host 134.219.148.11:61166
Accept-Encoding gzip, deflate
User-Agent Mozilla/5.0(Macintosh; Intel Mac OS X ... )
Accept-Language en-us
Cache-Control max-age=0
Connection close
The IP address I am attempting to break is: 134.219.148.11.61166
When I break it, I get a new ip address.
Below is the source code for the page.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Level 2</title>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css" rel="stylesheet">
<link href="site.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="page-header">
<h1>Level 2</h1>
<p class="lead">
<h2>Active Users</h2>
</p>
</div>
<div id="userlist">
<pre>Checking for users...</pre>
</div>
</div>
<script language="JavaScript">
var http_request = false;
function getusers() {
if (window.XMLHttpRequest) { // non IE
http_request = new XMLHttpRequest();
}
else if (window.ActiveXObject) { //
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (error) {}
}
if (!http_request) {
alert('Cannot create XML HTTP instance');
return false;
}
http_request.onreadystatechange = stateManager;
var myurl = "cgi-bin/users.php";
var f = document.getElementById("filter");
if (f != null) {
if (f.value != '') {
myurl = myurl + "?filter=" + f.value;
}
}
http_request.open("GET", myurl, true);
http_request.send(null);
}
function stateManager() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
updatepage(http_request.responseText);
} else {
alert('There was a problem with the request.');
}
}
}
function updatepage(str) {
document.getElementById("userlist").innerHTML = str;
}
setTimeout("getusers()", 5000);
</script>
</body>
</html>
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Working with Susy 2 Grid Layouts</title>
<link rel="stylesheet" href="css/app.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="css/normalize.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.5.0/pure-min.css">
</head>
<body>
<div class="notice"><h3>Susy is GREAT.. But really..!</h3></div>
<div class="container">
<div class="one"><strong>1</strong><br />
#include span(8)<br />
#include prefix(1) <em>//padding</em><br />
</div>
<div class="buttons">
A Pure Button
</div>
<div class="notice">this is some notice</div>
</div>
</body>
</html>
app.scss
#import 'susy';
$susy: (
flow: ltr,
output: float,
math: fluid,
column-width: false,
container: 1140px,
last-flow: to,
columns: 12,
gutters: 1/8,
gutter-position: after,
global-box-sizing: border-box,
debug: (
image: show,
color: rgba(green, .25),
output: background,
toggle: top right
),
);
#include global-box-sizing(border-box);
img {
width: 100%;
height: auto;
}
.notice {
#include full;
background-color: yellow;
}
.notice {
padding: 5px 8px;
}
.container {
#include container;
font-size: small;
}
em {
background-color: yellow;
color: black;
font-weight: bold;
}
.one {
#include span(8); // can be narrow(default), wide & wider
#include prefix(1);
height: 200px;
background-color: blue;
color: white;
}
.buttons {
#include span(1 at 2 fluid isolate); // shouln't this be 1 at 10 as it is still in context of 12???
}
Shouldn't that span shorthand with isolate mode, specify column 10 instead
of 2, as I am still in a context of 12 columns, and first 8 were occupied by
.one div? Everything other in Susy behaves logically and I did not have any
problems but this one trips me off.
However, if I specify:
.buttons {
#include break; // which does clear:both on this element
#include span(1 at 10 fluid isolate);
}
, then I have to tell it to be on 10th column. Is this supposed to work like
this?
Since Susy is not aware of the DOM, all positioning is relative to the default flow. Isolation can work around that, if everything in a given context is isolated — because that pulls everything out of the horizontal flow. But when you isolate only one element, it will position itself off other elements to it's left.
Animation using hardware acceleration CSS3 tags (see code below) works well in Google Chrome PC browser and Android browser on Samsung Galaxy SIII. However, the same does not work on Android browser on Samsung Galaxy Tab 10.1. How to realize hardware accelerated slide in/out animation on Samsung Galaxy Tab device?
<!DOCTYPE html>
<html>
<head>
<style>
#div1
{
border: 1px solid black;
background-color: red;
position: fixed;
left: 0px;
}
#div1.active
{
-webkit-transform-origin: 0% 0%;
-webkit-transition-timing-function: cubic-bezier(0.1, 0.25, 0.1, 1.0);
-webkit-transition-duration:2s;
-webkit-transform: translate3d(-100px,0px,0px);
}
#div1.inactive
{
-webkit-transform-origin: 0% 0%;
-webkit-transition-timing-function: cubic-bezier(0.1, 0.25, 0.1, 1.0);
-webkit-transition-duration:2s;
-webkit-transform: translate3d(0px,0px,0px);
}
#button1
{
position: fixed;
left: 200px;
}
</style>
<script>
var flag = 1;
function myFunction()
{
if (++flag % 2 === 0) {
//alert("active");
document.getElementById("div1").setAttribute("class", "");
document.getElementById("div1").setAttribute("class", "active");
} else {
//alert("inactive");
document.getElementById("div1").setAttribute("class", "");
document.getElementById("div1").setAttribute("class", "inactive");
}
}
</script>
</head>
<body>
<div id="div1">HELLO</div>
<button id="button1" onclick="myFunction()">Click me</button>
</body>
</html>
Kind regards,
Vinaya